Skip to content

Commit

Permalink
spi: sprd-adi: silence an uninitialized variable warning
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Dan Carpenter authored and Mark Brown committed Sep 25, 2017
1 parent 04063a0 commit b0d6e09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-sprd-adi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b0d6e09

Please sign in to comment.