public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: sophgo: fix incorrect type for ret in sg2044_spifmc_write()
@ 2025-03-13 21:45 Qasim Ijaz
  2025-03-17 19:42 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Qasim Ijaz @ 2025-03-13 21:45 UTC (permalink / raw)
  To: broonie, looong.bin; +Cc: linux-spi, linux-kernel

The sg2044_spifmc_write() function uses 'ret' of unsigned type 
size_t to capture return values from sg2044_spifmc_wait_xfer_size() 
and sg2044_spifmc_wait_int(). Since these functions may return 
negative error codes, using an unsigned type prevents proper 
error detection, as size_t cannot represent negative values. 

Change 'ret' to type int so that negative values are handled correctly.

Fixes: de16c322eefb ("spi: sophgo: add SG2044 SPI NOR controller driver")
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
 drivers/spi/spi-sg2044-nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sg2044-nor.c b/drivers/spi/spi-sg2044-nor.c
index 454153a63b42..baa4cf677663 100644
--- a/drivers/spi/spi-sg2044-nor.c
+++ b/drivers/spi/spi-sg2044-nor.c
@@ -216,7 +216,7 @@ static ssize_t sg2044_spifmc_write(struct sg2044_spifmc *spifmc,
 	size_t xfer_size;
 	const u8 *dout = op->data.buf.out;
 	int i, offset;
-	size_t ret;
+	int ret;
 	u32 reg;
 
 	reg = sg2044_spifmc_init_reg(spifmc);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-17 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 21:45 [PATCH] spi: sophgo: fix incorrect type for ret in sg2044_spifmc_write() Qasim Ijaz
2025-03-17 19:42 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox