diff mbox series

[next] spi: Fix self assignment issue with ancillary->mode

Message ID 20210623172300.161484-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit b01d550663fa5fd40a1785b0f1211fb657892edf
Headers show
Series [next] spi: Fix self assignment issue with ancillary->mode | expand

Commit Message

Colin King June 23, 2021, 5:23 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

There is an assignment of ancillary->mode to itself which looks
dubious since the proceeding comment states that the speed and
mode is taken over from the SPI main device, indicating that
ancillary->mode should assigned using the value spi->mode.
Fix this.

Addresses-Coverity: ("Self assignment")
Fixes: 0c79378c0199 ("spi: add ancillary device support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown June 25, 2021, 1:24 p.m. UTC | #1
On Wed, 23 Jun 2021 18:23:00 +0100, Colin King wrote:
> There is an assignment of ancillary->mode to itself which looks
> dubious since the proceeding comment states that the speed and
> mode is taken over from the SPI main device, indicating that
> ancillary->mode should assigned using the value spi->mode.
> Fix this.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: Fix self assignment issue with ancillary->mode
      commit: b01d550663fa5fd40a1785b0f1211fb657892edf

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b1b6031961b7..3104055a54e2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2184,7 +2184,7 @@  struct spi_device *spi_new_ancillary_device(struct spi_device *spi,
 
 	/* Take over SPI mode/speed from SPI main device */
 	ancillary->max_speed_hz = spi->max_speed_hz;
-	ancillary->mode = ancillary->mode;
+	ancillary->mode = spi->mode;
 
 	/* Register the new device */
 	rc = spi_add_device_locked(ancillary);