diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-03-28 11:35:26 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-04-09 15:17:36 -0400 |
commit | 8528e07edfc6ac5a793509f305b9c3c4fb3672c0 (patch) | |
tree | ea57a83f1c4d2ed4187b50ac341d519da7a2ea2b /drivers/hwmon/smsc47b397.c | |
parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) |
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>
Diffstat (limited to 'drivers/hwmon/smsc47b397.c')
-rw-r--r-- | drivers/hwmon/smsc47b397.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index d3b778da3f86..c5f6be478bad 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -343,10 +343,11 @@ exit: | |||
343 | return err; | 343 | return err; |
344 | } | 344 | } |
345 | 345 | ||
346 | static int __init smsc47b397_find(unsigned short *addr) | 346 | static int __init smsc47b397_find(void) |
347 | { | 347 | { |
348 | u8 id, rev; | 348 | u8 id, rev; |
349 | char *name; | 349 | char *name; |
350 | unsigned short addr; | ||
350 | 351 | ||
351 | superio_enter(); | 352 | superio_enter(); |
352 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 353 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr) | |||
370 | rev = superio_inb(SUPERIO_REG_DEVREV); | 371 | rev = superio_inb(SUPERIO_REG_DEVREV); |
371 | 372 | ||
372 | superio_select(SUPERIO_REG_LD8); | 373 | superio_select(SUPERIO_REG_LD8); |
373 | *addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) | 374 | addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) |
374 | | superio_inb(SUPERIO_REG_BASE_LSB); | 375 | | superio_inb(SUPERIO_REG_BASE_LSB); |
375 | 376 | ||
376 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", | 377 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", |
377 | name, *addr, rev); | 378 | name, addr, rev); |
378 | 379 | ||
379 | superio_exit(); | 380 | superio_exit(); |
380 | return 0; | 381 | return addr; |
381 | } | 382 | } |
382 | 383 | ||
383 | static int __init smsc47b397_init(void) | 384 | static int __init smsc47b397_init(void) |
@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void) | |||
385 | unsigned short address; | 386 | unsigned short address; |
386 | int ret; | 387 | int ret; |
387 | 388 | ||
388 | ret = smsc47b397_find(&address); | 389 | ret = smsc47b397_find(); |
389 | if (ret) | 390 | if (ret < 0) |
390 | return ret; | 391 | return ret; |
392 | address = ret; | ||
391 | 393 | ||
392 | ret = platform_driver_register(&smsc47b397_driver); | 394 | ret = platform_driver_register(&smsc47b397_driver); |
393 | if (ret) | 395 | if (ret) |