spi: fsl-espi: improve return value handling in fsl_espi_bufs
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 7 Sep 2016 20:52:43 +0000 (22:52 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 12 Sep 2016 18:58:45 +0000 (19:58 +0100)
Return a proper status code from fsl_espi_bufs instead of returning
the number of remaining words and let the caller evaluate it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-espi.c

index f8a6dd13ee02a0a29f86c838e414210e1caf60b8..8d6a570ac70484b05cc28f4f7e29b5b3b7b33385 100644 (file)
@@ -258,7 +258,7 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
        /* disable rx ints */
        mpc8xxx_spi_write_reg(&reg_base->mask, 0);
 
-       return mpc8xxx_spi->count;
+       return mpc8xxx_spi->count > 0 ? -EMSGSIZE : 0;
 }
 
 static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans)
@@ -288,9 +288,6 @@ static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans)
        if (trans->len)
                ret = fsl_espi_bufs(spi, trans);
 
-       if (ret)
-               ret = -EMSGSIZE;
-
        if (trans->delay_usecs)
                udelay(trans->delay_usecs);
 
This page took 0.027008 seconds and 5 git commands to generate.