[PATCH] omap-mcspi: When overriding SPI settings do not clobber status return value

From: David Bender
Date: Wed Mar 04 2015 - 11:36:21 EST


The call to omap2_mcspi_setup_transfer(spi, NULL) clobbers the previous
status value, possibly masking hardware transfer errors. Instead record
a separate status for this call. Give preference to reporting a hardware
transfer error over any error returned by omap2_mcspi_setup_transfer()

Signed-off-by: Dave Bender <bender@xxxxxxxxxxx>
---
drivers/spi/spi-omap2-mcspi.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 4df8942..6a4bd08 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1180,8 +1180,10 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
}
/* Restore defaults if they were overriden */
if (par_override) {
+ int status_transfer;
par_override = 0;
- status = omap2_mcspi_setup_transfer(spi, NULL);
+ status_transfer = omap2_mcspi_setup_transfer(spi, NULL);
+ status = status ? status : status_transfer;
}

if (cs_active)
--
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/