aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/smsc47m1.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-03-28 11:55:12 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-04-09 15:17:38 -0400
commit1d0045ee4a220872b65147b5b290e4a4852386d9 (patch)
tree8f4a30ff25413a6b6ce885961c99ae1adf50a8ad /drivers/hwmon/smsc47m1.c
parent776cdc11b3b0fc21e34600e22abe1c8209d2f3f0 (diff)
hwmon: (smsc47m1) Fix compiler warning
Some configurations produce the following compiler warning: drivers/hwmon/smsc47m1.c: In function 'sm_smsc47m1_init': drivers/hwmon/smsc47m1.c:938: warning: 'address' may be used uninitialized in this function While this is a false positive, it can easily be fixed by overloading the return value from smsc47m1_find with both address and error return code (the address is an unsigned short and thus never negative). This also reduces module size by a few bytes (46 bytes for x86_64). Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
Diffstat (limited to 'drivers/hwmon/smsc47m1.c')
-rw-r--r--drivers/hwmon/smsc47m1.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index c590c1469793..b5aa38dd7ab9 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = {
491 .attrs = smsc47m1_attributes, 491 .attrs = smsc47m1_attributes,
492}; 492};
493 493
494static int __init smsc47m1_find(unsigned short *addr, 494static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data)
495 struct smsc47m1_sio_data *sio_data)
496{ 495{
497 u8 val; 496 u8 val;
497 unsigned short addr;
498 498
499 superio_enter(); 499 superio_enter();
500 val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); 500 val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr,
546 } 546 }
547 547
548 superio_select(); 548 superio_select();
549 *addr = (superio_inb(SUPERIO_REG_BASE) << 8) 549 addr = (superio_inb(SUPERIO_REG_BASE) << 8)
550 | superio_inb(SUPERIO_REG_BASE + 1); 550 | superio_inb(SUPERIO_REG_BASE + 1);
551 if (*addr == 0) { 551 if (addr == 0) {
552 pr_info("Device address not set, will not use\n"); 552 pr_info("Device address not set, will not use\n");
553 superio_exit(); 553 superio_exit();
554 return -ENODEV; 554 return -ENODEV;
@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr,
565 } 565 }
566 566
567 superio_exit(); 567 superio_exit();
568 return 0; 568 return addr;
569} 569}
570 570
571/* Restore device to its initial state */ 571/* Restore device to its initial state */
@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void)
938 unsigned short address; 938 unsigned short address;
939 struct smsc47m1_sio_data sio_data; 939 struct smsc47m1_sio_data sio_data;
940 940
941 if (smsc47m1_find(&address, &sio_data)) 941 err = smsc47m1_find(&sio_data);
942 return -ENODEV; 942 if (err < 0)
943 return err;
944 address = err;
943 945
944 /* Sets global pdev as a side effect */ 946 /* Sets global pdev as a side effect */
945 err = smsc47m1_device_add(address, &sio_data); 947 err = smsc47m1_device_add(address, &sio_data);
946 if (err) 948 if (err)
947 goto exit; 949 return err;
948 950
949 err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); 951 err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe);
950 if (err) 952 if (err)
@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void)
955exit_device: 957exit_device:
956 platform_device_unregister(pdev); 958 platform_device_unregister(pdev);
957 smsc47m1_restore(&sio_data); 959 smsc47m1_restore(&sio_data);
958exit:
959 return err; 960 return err;
960} 961}
961 962