Re: [PATCH] spi: Fix warning for Clang build

From: Mark Brown
Date: Thu Feb 10 2022 - 06:17:15 EST


On Thu, Feb 10, 2022 at 10:36:56AM +0800, Li-hao Kuo wrote:

> - int mode, ret;
> + int mode, ret = 0;
>
> mode = SP7021_SPI_IDLE;
> if (xfer->tx_buf && xfer->rx_buf) {
> @@ -403,7 +403,7 @@ static int sp7021_spi_slave_transfer_one(struct spi_controller *ctlr, struct spi
> ret = sp7021_spi_slave_rx(spi, xfer);
> break;
> default:
> - break;
> + return -EINVAL;

The return here means that the initialization is now redundant and will
stop the compiler spotting any future similar issues which isn't ideal.

Attachment: signature.asc
Description: PGP signature