Skip to contentSkip to conversation

mtd: physmap_of: fix set but unused warning

PATCH New Brian Norris 1 participant 1 message Mar 7, 2016 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: physmap_of: fix set but unused warning

drivers/mtd/maps/physmap_of.c: In function ‘of_flash_probe’:
drivers/mtd/maps/physmap_of.c:165:16: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]

This could be a problem if the 'reg' property is not set, since that means 'count' will be uninitialized.

---
Compile tested only

 drivers/mtd/maps/physmap_of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap_of.c +1 -1
index 70c453144f00..eb569f61f5e7 100644
@@ -185,7 +185,7 @@ static int of_flash_probe(struct platform_device *dev)
 	 * consists internally of 2 non-identical NOR chips on one die.
 	 */
 	p = of_get_property(dp, "reg", &count);
-	if (count % reg_tuple_size != 0) {
+	if (!p || count % reg_tuple_size != 0) {
 		dev_err(&dev->dev, "Malformed reg property on %s\n",
 				dev->dev.of_node->full_name);
 		err = -EINVAL;
Signature · 1 line
2.7.0.rc3.207.g0ac5344