diff options
Diffstat (limited to 'drivers/hwmon/smsc47m1.c')
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 1e21c8cc948f..1de2f2be8708 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -597,6 +597,7 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev) | |||
597 | error_remove_files: | 597 | error_remove_files: |
598 | sysfs_remove_group(&dev->kobj, &smsc47m1_group); | 598 | sysfs_remove_group(&dev->kobj, &smsc47m1_group); |
599 | error_free: | 599 | error_free: |
600 | platform_set_drvdata(pdev, NULL); | ||
600 | kfree(data); | 601 | kfree(data); |
601 | error_release: | 602 | error_release: |
602 | release_region(res->start, SMSC_EXTENT); | 603 | release_region(res->start, SMSC_EXTENT); |
@@ -608,12 +609,12 @@ static int __devexit smsc47m1_remove(struct platform_device *pdev) | |||
608 | struct smsc47m1_data *data = platform_get_drvdata(pdev); | 609 | struct smsc47m1_data *data = platform_get_drvdata(pdev); |
609 | struct resource *res; | 610 | struct resource *res; |
610 | 611 | ||
611 | platform_set_drvdata(pdev, NULL); | ||
612 | hwmon_device_unregister(data->class_dev); | 612 | hwmon_device_unregister(data->class_dev); |
613 | sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group); | 613 | sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group); |
614 | 614 | ||
615 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 615 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
616 | release_region(res->start, SMSC_EXTENT); | 616 | release_region(res->start, SMSC_EXTENT); |
617 | platform_set_drvdata(pdev, NULL); | ||
617 | kfree(data); | 618 | kfree(data); |
618 | 619 | ||
619 | return 0; | 620 | return 0; |
@@ -693,15 +694,12 @@ static int __init smsc47m1_device_add(unsigned short address, | |||
693 | goto exit_device_put; | 694 | goto exit_device_put; |
694 | } | 695 | } |
695 | 696 | ||
696 | pdev->dev.platform_data = kmalloc(sizeof(struct smsc47m1_sio_data), | 697 | err = platform_device_add_data(pdev, sio_data, |
697 | GFP_KERNEL); | 698 | sizeof(struct smsc47m1_sio_data)); |
698 | if (!pdev->dev.platform_data) { | 699 | if (err) { |
699 | err = -ENOMEM; | ||
700 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); | 700 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); |
701 | goto exit_device_put; | 701 | goto exit_device_put; |
702 | } | 702 | } |
703 | memcpy(pdev->dev.platform_data, sio_data, | ||
704 | sizeof(struct smsc47m1_sio_data)); | ||
705 | 703 | ||
706 | err = platform_device_add(pdev); | 704 | err = platform_device_add(pdev); |
707 | if (err) { | 705 | if (err) { |