summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-amd.c
diff options
context:
space:
mode:
authorShreeya Patel <shreeya.patel@collabora.com>2022-08-30 15:06:07 +0530
committerMark Brown <broonie@kernel.org>2022-08-30 11:21:34 +0100
commit9477420efc41f60f06413cefa38f5bfd71ba64d8 (patch)
tree36dddb2138c8cbd758291138d19a35e61f57021c /drivers/spi/spi-amd.c
parentf4d381038700361f92d157288b0e18d87fab6c6d (diff)
downloadlwn-9477420efc41f60f06413cefa38f5bfd71ba64d8.tar.gz
lwn-9477420efc41f60f06413cefa38f5bfd71ba64d8.zip
spi: amd: Fix speed selection
If the current speed is equal to the requested speed by the device then return success. This patch fixes a bug introduced by the commit 3fe26121dc3a ("spi: amd: Configure device speed") which checks speed_hz instead of amd_spi->speed_hz. Fixes: 3fe26121dc3a ("spi: amd: Configure device speed") Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com> Link: https://lore.kernel.org/r/20220830093607.45484-1-shreeya.patel@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-amd.c')
-rw-r--r--drivers/spi/spi-amd.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index 264633c5ce0b..e23121456c70 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -240,9 +240,6 @@ static int amd_set_spi_freq(struct amd_spi *amd_spi, u32 speed_hz)
{
unsigned int i, spd7_val, alt_spd;
- if (speed_hz == amd_spi->speed_hz)
- return 0;
-
if (speed_hz < AMD_SPI_MIN_HZ)
return -EINVAL;
@@ -250,7 +247,7 @@ static int amd_set_spi_freq(struct amd_spi *amd_spi, u32 speed_hz)
if (speed_hz >= amd_spi_freq[i].speed_hz)
break;
- if (speed_hz == amd_spi_freq[i].speed_hz)
+ if (amd_spi->speed_hz == amd_spi_freq[i].speed_hz)
return 0;
amd_spi->speed_hz = amd_spi_freq[i].speed_hz;