From: Guenter Roeck Date: Fri, 13 Sep 2013 17:59:27 +0000 (-0700) Subject: hwmon: (atxp1) Set and use error code from vid_to_reg() X-Git-Tag: upstream/snapshot3+hdmi~4015^2~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=674d0ed8588c11ec9f70c8427ac83a73e0d156d5;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Reviewed-by: Jean Delvare --- diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index aecb9ea..ddff02e 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -147,10 +147,9 @@ static ssize_t atxp1_storevcore(struct device *dev, /* Calculate VID */ vid = vid_to_reg(vcore, data->vrm); - if (vid < 0) { dev_err(dev, "VID calculation failed.\n"); - return -1; + return vid; } /* diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h index f346e4d..da0a680 100644 --- a/include/linux/hwmon-vid.h +++ b/include/linux/hwmon-vid.h @@ -38,7 +38,7 @@ static inline int vid_to_reg(int val, u8 vrm) return ((val >= 1100) && (val <= 1850) ? ((18499 - val * 10) / 25 + 5) / 10 : -1); default: - return -1; + return -EINVAL; } }