Skip to content

Commit

Permalink
spi: Fix self assignment issue with ancillary->mode
Browse files Browse the repository at this point in the history
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: 0c79378 ("spi: add ancillary device support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210623172300.161484-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Colin Ian King authored and Mark Brown committed Jun 24, 2021
1 parent d74d992 commit b01d550
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,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);
Expand Down

0 comments on commit b01d550

Please sign in to comment.