diff options
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index c590c1469793..b5aa38dd7ab9 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = { | |||
491 | .attrs = smsc47m1_attributes, | 491 | .attrs = smsc47m1_attributes, |
492 | }; | 492 | }; |
493 | 493 | ||
494 | static int __init smsc47m1_find(unsigned short *addr, | 494 | static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
495 | struct smsc47m1_sio_data *sio_data) | ||
496 | { | 495 | { |
497 | u8 val; | 496 | u8 val; |
497 | unsigned short addr; | ||
498 | 498 | ||
499 | superio_enter(); | 499 | superio_enter(); |
500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | superio_select(); | 548 | superio_select(); |
549 | *addr = (superio_inb(SUPERIO_REG_BASE) << 8) | 549 | addr = (superio_inb(SUPERIO_REG_BASE) << 8) |
550 | | superio_inb(SUPERIO_REG_BASE + 1); | 550 | | superio_inb(SUPERIO_REG_BASE + 1); |
551 | if (*addr == 0) { | 551 | if (addr == 0) { |
552 | pr_info("Device address not set, will not use\n"); | 552 | pr_info("Device address not set, will not use\n"); |
553 | superio_exit(); | 553 | superio_exit(); |
554 | return -ENODEV; | 554 | return -ENODEV; |
@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
565 | } | 565 | } |
566 | 566 | ||
567 | superio_exit(); | 567 | superio_exit(); |
568 | return 0; | 568 | return addr; |
569 | } | 569 | } |
570 | 570 | ||
571 | /* Restore device to its initial state */ | 571 | /* Restore device to its initial state */ |
@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void) | |||
938 | unsigned short address; | 938 | unsigned short address; |
939 | struct smsc47m1_sio_data sio_data; | 939 | struct smsc47m1_sio_data sio_data; |
940 | 940 | ||
941 | if (smsc47m1_find(&address, &sio_data)) | 941 | err = smsc47m1_find(&sio_data); |
942 | return -ENODEV; | 942 | if (err < 0) |
943 | return err; | ||
944 | address = err; | ||
943 | 945 | ||
944 | /* Sets global pdev as a side effect */ | 946 | /* Sets global pdev as a side effect */ |
945 | err = smsc47m1_device_add(address, &sio_data); | 947 | err = smsc47m1_device_add(address, &sio_data); |
946 | if (err) | 948 | if (err) |
947 | goto exit; | 949 | return err; |
948 | 950 | ||
949 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); | 951 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); |
950 | if (err) | 952 | if (err) |
@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void) | |||
955 | exit_device: | 957 | exit_device: |
956 | platform_device_unregister(pdev); | 958 | platform_device_unregister(pdev); |
957 | smsc47m1_restore(&sio_data); | 959 | smsc47m1_restore(&sio_data); |
958 | exit: | ||
959 | return err; | 960 | return err; |
960 | } | 961 | } |
961 | 962 | ||