RTC/watchdog: M41T80: fix a potential use of unitialized data
authorMaciej W. Rozycki <[email protected]>
Mon, 12 May 2008 21:02:35 +0000 (14:02 -0700)
committerLinus Torvalds <[email protected]>
Tue, 13 May 2008 15:02:26 +0000 (08:02 -0700)
Watchdog handlers within the driver make use of "save_client" -- make sure it
has been initalized before the handlers are registered.

Signed-off-by: Maciej W. Rozycki <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexander Bigga <[email protected]>
Cc: Wim Van Sebroeck <[email protected]>
Cc: David Brownell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/rtc/rtc-m41t80.c

index 316bfaa80872195badfeda9ec87de81265d77d96..3d451ece253ca7d38dbb388237cc5f264d4fea1d 100644 (file)
@@ -803,6 +803,7 @@ static int m41t80_probe(struct i2c_client *client,
 
 #ifdef CONFIG_RTC_DRV_M41T80_WDT
        if (clientdata->features & M41T80_FEATURE_HT) {
+               save_client = client;
                rc = misc_register(&wdt_dev);
                if (rc)
                        goto exit;
@@ -811,7 +812,6 @@ static int m41t80_probe(struct i2c_client *client,
                        misc_deregister(&wdt_dev);
                        goto exit;
                }
-               save_client = client;
        }
 #endif
        return 0;