Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326187
b: refs/heads/master
c: 505dc0c
h: refs/heads/master
i:
  326185: 31abd17
  326183: 1e52aca
v: v3
  • Loading branch information
Guenter Roeck committed Sep 24, 2012
1 parent fab3349 commit 740a517
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b25df2bfbe2e7faddbb4f517e39de0323eef3ec7
refs/heads/master: 505dc0cc7e99279d60f5c3508018682beee22d65
23 changes: 7 additions & 16 deletions trunk/drivers/hwmon/via-cputemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
int err;
u32 eax, edx;

data = kzalloc(sizeof(struct via_cputemp_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM;
dev_err(&pdev->dev, "Out of memory\n");
goto exit;
}
data = devm_kzalloc(&pdev->dev, sizeof(struct via_cputemp_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;

data->id = pdev->id;
data->name = "via_cputemp";
Expand All @@ -151,23 +149,22 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
data->msr_temp = 0x1423;
break;
default:
err = -ENODEV;
goto exit_free;
return -ENODEV;
}

/* test if we can access the TEMPERATURE MSR */
err = rdmsr_safe_on_cpu(data->id, data->msr_temp, &eax, &edx);
if (err) {
dev_err(&pdev->dev,
"Unable to access TEMPERATURE MSR, giving up\n");
goto exit_free;
return err;
}

platform_set_drvdata(pdev, data);

err = sysfs_create_group(&pdev->dev.kobj, &via_cputemp_group);
if (err)
goto exit_free;
return err;

if (data->msr_vid)
data->vrm = vid_which_vrm();
Expand All @@ -192,10 +189,6 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
if (data->vrm)
device_remove_file(&pdev->dev, &dev_attr_cpu0_vid);
sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group);
exit_free:
platform_set_drvdata(pdev, NULL);
kfree(data);
exit:
return err;
}

Expand All @@ -207,8 +200,6 @@ static int __devexit via_cputemp_remove(struct platform_device *pdev)
if (data->vrm)
device_remove_file(&pdev->dev, &dev_attr_cpu0_vid);
sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group);
platform_set_drvdata(pdev, NULL);
kfree(data);
return 0;
}

Expand Down

0 comments on commit 740a517

Please sign in to comment.