提交 0038389a 编写于 作者: G Guenter Roeck

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: NGuenter Roeck <linux@roeck-us.net>
Acked-by: NHans de Goede <hdegoede@redhat.com>
上级 979570e0
...@@ -2532,10 +2532,10 @@ static int f71882fg_remove(struct platform_device *pdev) ...@@ -2532,10 +2532,10 @@ static int f71882fg_remove(struct platform_device *pdev)
return 0; return 0;
} }
static int __init f71882fg_find(int sioaddr, unsigned short *address, static int __init f71882fg_find(int sioaddr, struct f71882fg_sio_data *sio_data)
struct f71882fg_sio_data *sio_data)
{ {
u16 devid; u16 devid;
unsigned short address;
int err = superio_enter(sioaddr); int err = superio_enter(sioaddr);
if (err) if (err)
return err; return err;
...@@ -2603,25 +2603,25 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, ...@@ -2603,25 +2603,25 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
goto exit; goto exit;
} }
*address = superio_inw(sioaddr, SIO_REG_ADDR); address = superio_inw(sioaddr, SIO_REG_ADDR);
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;
} }
*address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */
err = 0; err = address;
pr_info("Found %s chip at %#x, revision %d\n", pr_info("Found %s chip at %#x, revision %d\n",
f71882fg_names[sio_data->type], (unsigned int)*address, f71882fg_names[sio_data->type], (unsigned int)address,
(int)superio_inb(sioaddr, SIO_REG_DEVREV)); (int)superio_inb(sioaddr, SIO_REG_DEVREV));
exit: exit:
superio_exit(sioaddr); superio_exit(sioaddr);
return err; return err;
} }
static int __init f71882fg_device_add(unsigned short address, static int __init f71882fg_device_add(int address,
const struct f71882fg_sio_data *sio_data) const struct f71882fg_sio_data *sio_data)
{ {
struct resource res = { struct resource res = {
.start = address, .start = address,
...@@ -2668,19 +2668,21 @@ static int __init f71882fg_device_add(unsigned short address, ...@@ -2668,19 +2668,21 @@ static int __init f71882fg_device_add(unsigned short address,
static int __init f71882fg_init(void) static int __init f71882fg_init(void)
{ {
int err = -ENODEV; int err;
unsigned short address; int address;
struct f71882fg_sio_data sio_data; struct f71882fg_sio_data sio_data;
memset(&sio_data, 0, sizeof(sio_data)); memset(&sio_data, 0, sizeof(sio_data));
if (f71882fg_find(0x2e, &address, &sio_data) && address = f71882fg_find(0x2e, &sio_data);
f71882fg_find(0x4e, &address, &sio_data)) if (address < 0)
goto exit; address = f71882fg_find(0x4e, &sio_data);
if (address < 0)
return address;
err = platform_driver_register(&f71882fg_driver); err = platform_driver_register(&f71882fg_driver);
if (err) if (err)
goto exit; return err;
err = f71882fg_device_add(address, &sio_data); err = f71882fg_device_add(address, &sio_data);
if (err) if (err)
...@@ -2690,7 +2692,6 @@ static int __init f71882fg_init(void) ...@@ -2690,7 +2692,6 @@ static int __init f71882fg_init(void)
exit_driver: exit_driver:
platform_driver_unregister(&f71882fg_driver); platform_driver_unregister(&f71882fg_driver);
exit:
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册