From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mark Brown <broonie@kernel.org>,
Baolin Wang <baolin.wang@spreadtrum.com>
Cc: linux-spi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] spi: sprd-adi: silence an uninitialized variable warning
Date: Fri, 22 Sep 2017 23:48:08 +0300 [thread overview]
Message-ID: <20170922204808.7o7jn7pfj4se2s5r@mwanda> (raw)
If of_get_property() fails then "size" is uninitialized and it leads to
a static checker warning:
drivers/spi/spi-sprd-adi.c:288 sprd_adi_hw_init()
error: uninitialized symbol 'size'.
We can silence the warning by re-arranging the order of these checks.
It obviously doesn't affect runtime at all.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c
index 0d481f8a46c2..146d674573f7 100644
--- a/drivers/spi/spi-sprd-adi.c
+++ b/drivers/spi/spi-sprd-adi.c
@@ -285,7 +285,7 @@ static void sprd_adi_hw_init(struct sprd_adi *sadi)
/* Set hardware channels setting */
list = of_get_property(np, "sprd,hw-channels", &size);
- if (!size || !list) {
+ if (!list || !size) {
dev_info(sadi->dev, "no hw channels setting in node\n");
return;
}
next reply other threads:[~2017-09-22 20:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 20:48 Dan Carpenter [this message]
2017-09-25 16:16 ` Applied "spi: sprd-adi: silence an uninitialized variable warning" to the spi tree 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=20170922204808.7o7jn7pfj4se2s5r@mwanda \
--to=dan.carpenter@oracle.com \
--cc=baolin.wang@spreadtrum.com \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-spi@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