]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
backlight: ili922x: Add an error code check in ili922x_write()
authorSu Hui <suhui@nfschina.com>
Thu, 30 Nov 2023 05:11:56 +0000 (13:11 +0800)
committerLee Jones <lee@kernel.org>
Thu, 7 Dec 2023 15:54:55 +0000 (15:54 +0000)
Clang static analyzer complains that value stored to 'ret' is never read.
Return the error code when spi_sync() failed.

Signed-off-by: Su Hui <suhui@nfschina.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20231130051155.1235972-1-suhui@nfschina.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/video/backlight/ili922x.c

index 206e77afc56f2787a7bf4c00302f8551cdaf07ec..c8e0e655dc867d49ac6729abecea39e9590a8792 100644 (file)
@@ -269,6 +269,10 @@ static int ili922x_write(struct spi_device *spi, u8 reg, u16 value)
        spi_message_add_tail(&xfer_regindex, &msg);
 
        ret = spi_sync(spi, &msg);
+       if (ret < 0) {
+               dev_err(&spi->dev, "Error sending SPI message 0x%x", ret);
+               return ret;
+       }
 
        spi_message_init(&msg);
        tbuf[0] = set_tx_byte(START_BYTE(ili922x_id, START_RS_REG,