spi: sophgo: fix incorrect type for ret in sg2044_spifmc_write()

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>
Link: https://patch.msgid.link/20250313214545.7444-1-qasdev00@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Qasim Ijaz 2025-03-13 21:45:45 +00:00 committed by Mark Brown
parent 336a41c90c
commit 3c9403f150
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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);