linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sukrut Bellary <sukrut.bellary@linux.com>
To: Mark Brown <broonie@kernel.org>
Cc: Sukrut Bellary <sukrut.bellary@linux.com>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] spi:pic32: Fix missing error code 'ret' in the failure path
Date: Sat, 13 May 2023 05:26:53 -0700	[thread overview]
Message-ID: <20230513122653.45226-1-sukrut.bellary@linux.com> (raw)

smatch warning -
drivers/spi/spi-pic32.c:634 pic32_spi_dma_prep() warn: missing error code 'ret'

Currently in case of pic32_spi_dma_config() failure, SUCCESS is returned.
Capture and return the error code in the failure path.

This is based on static analysis only. Compilation tested.

Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>
---
 drivers/spi/spi-pic32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index f2af5e653f3d..2b1b1eea9c64 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -630,7 +630,8 @@ static int pic32_spi_dma_prep(struct pic32_spi *pic32s, struct device *dev)
 		goto out_err;
 	}
 
-	if (pic32_spi_dma_config(pic32s, DMA_SLAVE_BUSWIDTH_1_BYTE))
+	ret = pic32_spi_dma_config(pic32s, DMA_SLAVE_BUSWIDTH_1_BYTE);
+	if (ret)
 		goto out_err;
 
 	/* DMA chnls allocated and prepared */
-- 
2.34.1


             reply	other threads:[~2023-05-13 12:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13 12:26 Sukrut Bellary [this message]
2023-05-13 15:14 ` [PATCH] spi:pic32: Fix missing error code 'ret' in the failure path andy.shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230513122653.45226-1-sukrut.bellary@linux.com \
    --to=sukrut.bellary@linux.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).