aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/sch56xx-common.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-08-04 12:54:16 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:29 -0400
commit313829ee3cccbc658409357f32a1508620b60142 (patch)
tree4f2c4eccda78eec49ff8bd73fad7ee868d18df79 /drivers/hwmon/sch56xx-common.c
parent0038389add7388954d74985ce7e631076216cf02 (diff)
hwmon: (sch56xx-common) Fix build warnings
Fix: warning: 'address' may be used uninitialized in this function warning: 'name' may be used uninitialized in this function While those are false warnings, the patch reduces module size on x86_64 by approximately 110 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/sch56xx-common.c')
-rw-r--r--drivers/hwmon/sch56xx-common.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c
index 4380f5d07be2..d00b30adc34b 100644
--- a/drivers/hwmon/sch56xx-common.c
+++ b/drivers/hwmon/sch56xx-common.c
@@ -503,10 +503,10 @@ EXPORT_SYMBOL(sch56xx_watchdog_unregister);
503 * platform dev find, add and remove functions 503 * platform dev find, add and remove functions
504 */ 504 */
505 505
506static int __init sch56xx_find(int sioaddr, unsigned short *address, 506static int __init sch56xx_find(int sioaddr, const char **name)
507 const char **name)
508{ 507{
509 u8 devid; 508 u8 devid;
509 unsigned short address;
510 int err; 510 int err;
511 511
512 err = superio_enter(sioaddr); 512 err = superio_enter(sioaddr);
@@ -540,20 +540,21 @@ static int __init sch56xx_find(int sioaddr, unsigned short *address,
540 * Warning the order of the low / high byte is the other way around 540 * Warning the order of the low / high byte is the other way around
541 * as on most other superio devices!! 541 * as on most other superio devices!!
542 */ 542 */
543 *address = superio_inb(sioaddr, SIO_REG_ADDR) | 543 address = superio_inb(sioaddr, SIO_REG_ADDR) |
544 superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8; 544 superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8;
545 if (*address == 0) { 545 if (address == 0) {
546 pr_warn("Base address not set\n"); 546 pr_warn("Base address not set\n");
547 err = -ENODEV; 547 err = -ENODEV;
548 goto exit; 548 goto exit;
549 } 549 }
550 err = address;
550 551
551exit: 552exit:
552 superio_exit(sioaddr); 553 superio_exit(sioaddr);
553 return err; 554 return err;
554} 555}
555 556
556static int __init sch56xx_device_add(unsigned short address, const char *name) 557static int __init sch56xx_device_add(int address, const char *name)
557{ 558{
558 struct resource res = { 559 struct resource res = {
559 .start = address, 560 .start = address,
@@ -593,15 +594,14 @@ exit_device_put:
593 594
594static int __init sch56xx_init(void) 595static int __init sch56xx_init(void)
595{ 596{
596 int err; 597 int address;
597 unsigned short address; 598 const char *name = NULL;
598 const char *name; 599
599 600 address = sch56xx_find(0x4e, &name);
600 err = sch56xx_find(0x4e, &address, &name); 601 if (address < 0)
601 if (err) 602 address = sch56xx_find(0x2e, &name);
602 err = sch56xx_find(0x2e, &address, &name); 603 if (address < 0)
603 if (err) 604 return address;
604 return err;
605 605
606 return sch56xx_device_add(address, name); 606 return sch56xx_device_add(address, name);
607} 607}