提交 313829ee 编写于 作者: G Guenter Roeck

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: NGuenter Roeck <linux@roeck-us.net>
Acked-by: NHans de Goede <hdegoede@redhat.com>
上级 0038389a
...@@ -503,10 +503,10 @@ EXPORT_SYMBOL(sch56xx_watchdog_unregister); ...@@ -503,10 +503,10 @@ EXPORT_SYMBOL(sch56xx_watchdog_unregister);
* platform dev find, add and remove functions * platform dev find, add and remove functions
*/ */
static int __init sch56xx_find(int sioaddr, unsigned short *address, static int __init sch56xx_find(int sioaddr, const char **name)
const char **name)
{ {
u8 devid; u8 devid;
unsigned short address;
int err; int err;
err = superio_enter(sioaddr); err = superio_enter(sioaddr);
...@@ -540,20 +540,21 @@ static int __init sch56xx_find(int sioaddr, unsigned short *address, ...@@ -540,20 +540,21 @@ static int __init sch56xx_find(int sioaddr, unsigned short *address,
* Warning the order of the low / high byte is the other way around * Warning the order of the low / high byte is the other way around
* as on most other superio devices!! * as on most other superio devices!!
*/ */
*address = superio_inb(sioaddr, SIO_REG_ADDR) | address = superio_inb(sioaddr, SIO_REG_ADDR) |
superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8; superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8;
if (*address == 0) { if (address == 0) {
pr_warn("Base address not set\n"); pr_warn("Base address not set\n");
err = -ENODEV; err = -ENODEV;
goto exit; goto exit;
} }
err = address;
exit: exit:
superio_exit(sioaddr); superio_exit(sioaddr);
return err; return err;
} }
static int __init sch56xx_device_add(unsigned short address, const char *name) static int __init sch56xx_device_add(int address, const char *name)
{ {
struct resource res = { struct resource res = {
.start = address, .start = address,
...@@ -593,15 +594,14 @@ static int __init sch56xx_device_add(unsigned short address, const char *name) ...@@ -593,15 +594,14 @@ static int __init sch56xx_device_add(unsigned short address, const char *name)
static int __init sch56xx_init(void) static int __init sch56xx_init(void)
{ {
int err; int address;
unsigned short address; const char *name = NULL;
const char *name;
address = sch56xx_find(0x4e, &name);
err = sch56xx_find(0x4e, &address, &name); if (address < 0)
if (err) address = sch56xx_find(0x2e, &name);
err = sch56xx_find(0x2e, &address, &name); if (address < 0)
if (err) return address;
return err;
return sch56xx_device_add(address, name); return sch56xx_device_add(address, name);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册