Commit 4276fc82 authored by Oleksandr Suvorov's avatar Oleksandr Suvorov Committed by Mark Brown

spi: spidev: fix speed setting message

The message of max device speed setting is shown when
an error in spi_setup() occurs.
Instead, it should be shown when the setup call succeeds.
Signed-off-by: default avatarOleksandr Suvorov <oleksandr.suvorov@toradex.com>
Link: https://lore.kernel.org/r/20200229161841.89144-3-oleksandr.suvorov@toradex.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ea70fb5b
...@@ -454,10 +454,11 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -454,10 +454,11 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
spi->max_speed_hz = tmp; spi->max_speed_hz = tmp;
retval = spi_setup(spi); retval = spi_setup(spi);
if (retval >= 0) if (retval == 0) {
spidev->speed_hz = tmp; spidev->speed_hz = tmp;
else dev_dbg(&spi->dev, "%d Hz (max)\n",
dev_dbg(&spi->dev, "%d Hz (max)\n", tmp); spidev->speed_hz);
}
spi->max_speed_hz = save; spi->max_speed_hz = save;
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment