aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-08-04 12:46:36 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:29 -0400
commit0038389add7388954d74985ce7e631076216cf02 (patch)
tree844c90adb3338d5c717f209ad753160e369ebc17 /drivers/hwmon/f71882fg.c
parent979570e02981d4a8fc20b3cc8fd651856c98ee9d (diff)
hwmon: (f71882fg) Fix build warning
Fix: warning: 'address' may be used uninitialized in this function [-Wuninitialized] While this is a false warning, the patch reduces module size on x86_64 by approximately 175 bytes, so it is still worth the effort. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 6d1226365e30..dd5ae567bf92 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -2532,10 +2532,10 @@ static int f71882fg_remove(struct platform_device *pdev)
2532 return 0; 2532 return 0;
2533} 2533}
2534 2534
2535static int __init f71882fg_find(int sioaddr, unsigned short *address, 2535static int __init f71882fg_find(int sioaddr, struct f71882fg_sio_data *sio_data)
2536 struct f71882fg_sio_data *sio_data)
2537{ 2536{
2538 u16 devid; 2537 u16 devid;
2538 unsigned short address;
2539 int err = superio_enter(sioaddr); 2539 int err = superio_enter(sioaddr);
2540 if (err) 2540 if (err)
2541 return err; 2541 return err;
@@ -2603,25 +2603,25 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
2603 goto exit; 2603 goto exit;
2604 } 2604 }
2605 2605
2606 *address = superio_inw(sioaddr, SIO_REG_ADDR); 2606 address = superio_inw(sioaddr, SIO_REG_ADDR);
2607 if (*address == 0) { 2607 if (address == 0) {
2608 pr_warn("Base address not set\n"); 2608 pr_warn("Base address not set\n");
2609 err = -ENODEV; 2609 err = -ENODEV;
2610 goto exit; 2610 goto exit;
2611 } 2611 }
2612 *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ 2612 address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */
2613 2613
2614 err = 0; 2614 err = address;
2615 pr_info("Found %s chip at %#x, revision %d\n", 2615 pr_info("Found %s chip at %#x, revision %d\n",
2616 f71882fg_names[sio_data->type], (unsigned int)*address, 2616 f71882fg_names[sio_data->type], (unsigned int)address,
2617 (int)superio_inb(sioaddr, SIO_REG_DEVREV)); 2617 (int)superio_inb(sioaddr, SIO_REG_DEVREV));
2618exit: 2618exit:
2619 superio_exit(sioaddr); 2619 superio_exit(sioaddr);
2620 return err; 2620 return err;
2621} 2621}
2622 2622
2623static int __init f71882fg_device_add(unsigned short address, 2623static int __init f71882fg_device_add(int address,
2624 const struct f71882fg_sio_data *sio_data) 2624 const struct f71882fg_sio_data *sio_data)
2625{ 2625{
2626 struct resource res = { 2626 struct resource res = {
2627 .start = address, 2627 .start = address,
@@ -2668,19 +2668,21 @@ exit_device_put:
2668 2668
2669static int __init f71882fg_init(void) 2669static int __init f71882fg_init(void)
2670{ 2670{
2671 int err = -ENODEV; 2671 int err;
2672 unsigned short address; 2672 int address;
2673 struct f71882fg_sio_data sio_data; 2673 struct f71882fg_sio_data sio_data;
2674 2674
2675 memset(&sio_data, 0, sizeof(sio_data)); 2675 memset(&sio_data, 0, sizeof(sio_data));
2676 2676
2677 if (f71882fg_find(0x2e, &address, &sio_data) && 2677 address = f71882fg_find(0x2e, &sio_data);
2678 f71882fg_find(0x4e, &address, &sio_data)) 2678 if (address < 0)
2679 goto exit; 2679 address = f71882fg_find(0x4e, &sio_data);
2680 if (address < 0)
2681 return address;
2680 2682
2681 err = platform_driver_register(&f71882fg_driver); 2683 err = platform_driver_register(&f71882fg_driver);
2682 if (err) 2684 if (err)
2683 goto exit; 2685 return err;
2684 2686
2685 err = f71882fg_device_add(address, &sio_data); 2687 err = f71882fg_device_add(address, &sio_data);
2686 if (err) 2688 if (err)
@@ -2690,7 +2692,6 @@ static int __init f71882fg_init(void)
2690 2692
2691exit_driver: 2693exit_driver:
2692 platform_driver_unregister(&f71882fg_driver); 2694 platform_driver_unregister(&f71882fg_driver);
2693exit:
2694 return err; 2695 return err;
2695} 2696}
2696 2697