[PATCH 02/11] mfd/asic3: fix asic3_mfd_probe return value

Arnd Bergmann arnd at arndb.de
Wed Aug 8 10:47:19 EDT 2012


In commit 4f304245b "mfd: Set asic3 DS1WM clock_rate", a possible
path through asic3_mfd_probe was introduced that would lead to
an unpredictable return value, if everything succeeds but there
are pdata->leds is NULL. This was reported correctly by gcc.

Without this patch, building magician_defconfig results in:

drivers/mfd/asic3.c: In function 'asic3_mfd_probe':
drivers/mfd/asic3.c:940:2: warning: 'ret' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Arnd Bergmann <arnd at arndb.de>
Cc: Paul Parsons <lost.distance at yahoo.com>
Cc: Philipp Zabel <philipp.zabel at gmail.com>
Cc: Samuel Ortiz <sameo at linux.intel.com>
---
 drivers/mfd/asic3.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 383421b..683e18a 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -925,6 +925,7 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
 			goto out;
 	}
 
+	ret = 0;
 	if (pdata->leds) {
 		int i;
 
-- 
1.7.10




More information about the linux-arm-kernel mailing list