mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
hwmon: (smsc47b397) Fix compiler warning
Some configurations produce the following compiler warning: drivers/hwmon/smsc47b397.c: In function 'smsc47b397_init': drivers/hwmon/smsc47b397.c:385: 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 smsc47b397_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 (64 bytes for x86_64). Cc: Mark M. Hoffman <mhoffman@lightlink.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:
parent
0034102808
commit
8528e07edf
1 changed files with 8 additions and 6 deletions
|
@ -343,10 +343,11 @@ exit:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init smsc47b397_find(unsigned short *addr)
|
static int __init smsc47b397_find(void)
|
||||||
{
|
{
|
||||||
u8 id, rev;
|
u8 id, rev;
|
||||||
char *name;
|
char *name;
|
||||||
|
unsigned short addr;
|
||||||
|
|
||||||
superio_enter();
|
superio_enter();
|
||||||
id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
|
id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
|
||||||
|
@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr)
|
||||||
rev = superio_inb(SUPERIO_REG_DEVREV);
|
rev = superio_inb(SUPERIO_REG_DEVREV);
|
||||||
|
|
||||||
superio_select(SUPERIO_REG_LD8);
|
superio_select(SUPERIO_REG_LD8);
|
||||||
*addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8)
|
addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8)
|
||||||
| superio_inb(SUPERIO_REG_BASE_LSB);
|
| superio_inb(SUPERIO_REG_BASE_LSB);
|
||||||
|
|
||||||
pr_info("found SMSC %s (base address 0x%04x, revision %u)\n",
|
pr_info("found SMSC %s (base address 0x%04x, revision %u)\n",
|
||||||
name, *addr, rev);
|
name, addr, rev);
|
||||||
|
|
||||||
superio_exit();
|
superio_exit();
|
||||||
return 0;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init smsc47b397_init(void)
|
static int __init smsc47b397_init(void)
|
||||||
|
@ -385,9 +386,10 @@ static int __init smsc47b397_init(void)
|
||||||
unsigned short address;
|
unsigned short address;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = smsc47b397_find(&address);
|
ret = smsc47b397_find();
|
||||||
if (ret)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
address = ret;
|
||||||
|
|
||||||
ret = platform_driver_register(&smsc47b397_driver);
|
ret = platform_driver_register(&smsc47b397_driver);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
Loading…
Add table
Reference in a new issue