diff mbox series

spi: gpio: Fix copy-and-paste error

Message ID 20180903214015.16147-1-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show
Series spi: gpio: Fix copy-and-paste error | expand

Commit Message

Linus Walleij Sept. 3, 2018, 9:40 p.m. UTC
This fixes an embarrassing copy-and-paste error in the
errorpath of spi_gpio_request(): we were checking the wrong
struct member for error code right after retrieveing the
sck GPIO.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/spi/spi-gpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Geert Uytterhoeven Sept. 4, 2018, 7:22 a.m. UTC | #1
Hi Linus,

On Mon, Sep 3, 2018 at 11:40 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> This fixes an embarrassing copy-and-paste error in the
> errorpath of spi_gpio_request(): we were checking the wrong
> struct member for error code right after retrieveing the
> sck GPIO.

Thanks for your patch!

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Fixes: 9b00bc7b901ff672 ("spi: spi-gpio: Rewrite to use GPIO descriptors")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/spi/spi-gpio.c
> +++ b/drivers/spi/spi-gpio.c
> @@ -422,7 +422,6 @@ static int spi_gpio_probe(struct platform_device *pdev)
>         spi_gpio->bitbang.master = master;
>         spi_gpio->bitbang.chipselect = spi_gpio_chipselect;
>         spi_gpio->bitbang.set_line_direction = spi_gpio_set_direction;
> -

Not really related to the actual fix...

>         if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) {
>                 spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0;
>                 spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1;

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 0626e6e3ea0c..9f4882f82c3c 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -300,8 +300,8 @@  static int spi_gpio_request(struct device *dev,
 		*mflags |= SPI_MASTER_NO_RX;
 
 	spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
-	if (IS_ERR(spi_gpio->mosi))
-		return PTR_ERR(spi_gpio->mosi);
+	if (IS_ERR(spi_gpio->sck))
+		return PTR_ERR(spi_gpio->sck);
 
 	for (i = 0; i < num_chipselects; i++) {
 		spi_gpio->cs_gpios[i] = devm_gpiod_get_index(dev, "cs",
@@ -422,7 +422,6 @@  static int spi_gpio_probe(struct platform_device *pdev)
 	spi_gpio->bitbang.master = master;
 	spi_gpio->bitbang.chipselect = spi_gpio_chipselect;
 	spi_gpio->bitbang.set_line_direction = spi_gpio_set_direction;
-
 	if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) {
 		spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0;
 		spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1;