Commit 674d0ed8588c11ec9f70c8427ac83a73e0d156d5

Authored by Guenter Roeck
1 parent 19f053c840

hwmon: (atxp1) Set and use error code from vid_to_reg()

vid_to_reg() returns -1 if it encounters an error. Return -EINVAL instead.
Its only caller, atxp1_storevcore(), doesn't use the return code but
returns -1 instead, which is wrong anyway as it means -EPERM.
Use the return value from vid_to_reg() instead to report the error.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>

Showing 2 changed files with 2 additions and 3 deletions Side-by-side Diff

drivers/hwmon/atxp1.c
... ... @@ -147,10 +147,9 @@
147 147  
148 148 /* Calculate VID */
149 149 vid = vid_to_reg(vcore, data->vrm);
150   -
151 150 if (vid < 0) {
152 151 dev_err(dev, "VID calculation failed.\n");
153   - return -1;
  152 + return vid;
154 153 }
155 154  
156 155 /*
include/linux/hwmon-vid.h
... ... @@ -38,7 +38,7 @@
38 38 return ((val >= 1100) && (val <= 1850) ?
39 39 ((18499 - val * 10) / 25 + 5) / 10 : -1);
40 40 default:
41   - return -1;
  41 + return -EINVAL;
42 42 }
43 43 }
44 44