public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Bender <codehero@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: David Bender <codehero@gmail.com>, Dave Bender <bender@benegon.com>
Subject: [PATCH] omap-mcspi: When overriding SPI settings do not clobber status return value
Date: Wed,  4 Mar 2015 11:35:41 -0500	[thread overview]
Message-ID: <1425486941-10121-1-git-send-email-codehero@gmail.com> (raw)

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@benegon.com>
---
 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


                 reply	other threads:[~2015-03-04 16:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425486941-10121-1-git-send-email-codehero@gmail.com \
    --to=codehero@gmail.com \
    --cc=bender@benegon.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox