Commit 82896072 authored by Alessandro Zummo's avatar Alessandro Zummo Committed by Linus Torvalds

[PATCH] RTC subsystem: RS5C372 sysfs fix

Fix sysfs show() return code
Signed-off-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent adfb4341
...@@ -169,24 +169,26 @@ static struct rtc_class_ops rs5c372_rtc_ops = { ...@@ -169,24 +169,26 @@ static struct rtc_class_ops rs5c372_rtc_ops = {
static ssize_t rs5c372_sysfs_show_trim(struct device *dev, static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int trim; int err, trim;
if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0) err = rs5c372_get_trim(to_i2c_client(dev), NULL, &trim);
return sprintf(buf, "0x%2x\n", trim); if (err)
return err;
return 0; return sprintf(buf, "0x%2x\n", trim);
} }
static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL);
static ssize_t rs5c372_sysfs_show_osc(struct device *dev, static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int osc; int err, osc;
if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0) err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL);
return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); if (err)
return err;
return 0; return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
} }
static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment