kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] spi: Fix self assignment issue with ancillary->mode
@ 2021-06-23 17:23 Colin King
  2021-06-25 13:24 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-06-23 17:23 UTC (permalink / raw)
  To: Mark Brown, linux-spi; +Cc: kernel-janitors, linux-kernel

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(-)

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


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

end of thread, other threads:[~2021-06-25 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 17:23 [PATCH][next] spi: Fix self assignment issue with ancillary->mode Colin King
2021-06-25 13:24 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).