From: Tomer Maimon <tmaimon77@gmail.com>
To: broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
yuenn@google.com, venture@google.com, brendanhiggins@google.com,
avifishman70@gmail.com, joel@jms.id.au
Cc: linux-spi@vger.kernel.org, openbmc@lists.ozlabs.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Tomer Maimon <tmaimon77@gmail.com>
Subject: [PATCH v1 1/1] spi: npcm: fix uninitialized 'val' warning in receive function
Date: Sun, 18 Nov 2018 14:35:04 +0200 [thread overview]
Message-ID: <20181118123504.83082-2-tmaimon77@gmail.com> (raw)
In-Reply-To: <20181118123504.83082-1-tmaimon77@gmail.com>
Fix uninitialized 'val' warning receive function, send function
has been modify to be aligned with the receive function.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/spi/spi-npcm-pspi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-npcm-pspi.c b/drivers/spi/spi-npcm-pspi.c
index 6dae91091143..f75df49ab84e 100644
--- a/drivers/spi/spi-npcm-pspi.c
+++ b/drivers/spi/spi-npcm-pspi.c
@@ -199,11 +199,11 @@ static void npcm_pspi_send(struct npcm_pspi *priv)
wsize = min(bytes_per_word(priv->bits_per_word), priv->tx_bytes);
priv->tx_bytes -= wsize;
- if (priv->tx_buf) {
- if (wsize == 1)
- iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
+ if (priv->tx_buf && wsize) {
if (wsize == 2)
iowrite16(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
+ else
+ iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base);
priv->tx_buf += wsize;
}
@@ -217,11 +217,11 @@ static void npcm_pspi_recv(struct npcm_pspi *priv)
rsize = min(bytes_per_word(priv->bits_per_word), priv->rx_bytes);
priv->rx_bytes -= rsize;
- if (priv->rx_buf) {
- if (rsize == 1)
- val = ioread8(priv->base + NPCM_PSPI_DATA);
+ if (priv->rx_buf && rsize) {
if (rsize == 2)
val = ioread16(priv->base + NPCM_PSPI_DATA);
+ else
+ val = ioread8(priv->base + NPCM_PSPI_DATA);
*priv->rx_buf = val;
priv->rx_buf += rsize;
--
2.14.1
next prev parent reply other threads:[~2018-11-18 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 12:35 [PATCH v1 0/1] npcm: fix uninitialized 'val' warning in receive function Tomer Maimon
2018-11-18 12:35 ` Tomer Maimon [this message]
2018-11-18 21:38 ` [PATCH v1 1/1] spi: " Olof Johansson
2018-11-20 10:51 ` Tomer Maimon
2018-11-20 13:02 ` Mark Brown
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=20181118123504.83082-2-tmaimon77@gmail.com \
--to=tmaimon77@gmail.com \
--cc=avifishman70@gmail.com \
--cc=brendanhiggins@google.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=openbmc@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=venture@google.com \
--cc=yuenn@google.com \
/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;
as well as URLs for NNTP newsgroup(s).