public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* mtd: ndfc: silence an underflow static checker warning
@ 2013-08-23 10:02 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-08-23 10:02 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Grant Likely, Rob Herring, Artem Bityutskiy, Bill Pemberton,
	Huang Shijie, linux-mtd, devicetree, kernel-janitors

"cs" is an index into the ndfc_ctrl[].  There is a sanity check which
does:

	if (cs >= NDFC_MAX_CS) {

It doesn't check for underflows and that upsets my static checker.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 8e148f1..cd78b81 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -201,8 +201,9 @@ static int ndfc_probe(struct platform_device *ofdev)
 {
 	struct ndfc_controller *ndfc;
 	const __be32 *reg;
+	unsigned int cs;
 	u32 ccr;
-	int err, len, cs;
+	int err, len;
 
 	/* Read the reg property to get the chip select */
 	reg = of_get_property(ofdev->dev.of_node, "reg", &len);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-23 10:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-23 10:02 mtd: ndfc: silence an underflow static checker warning Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox