Commit 015aefbb authored by Alessandro Zummo's avatar Alessandro Zummo Committed by Linus Torvalds

[PATCH] RTC subsystem: X1205 sysfs cleanup

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 3903586a
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/delay.h> #include <linux/delay.h>
#define DRV_VERSION "1.0.6" #define DRV_VERSION "1.0.7"
/* Addresses to scan: none. This chip is located at /* Addresses to scan: none. This chip is located at
* 0x6f and uses a two bytes register addressing. * 0x6f and uses a two bytes register addressing.
...@@ -473,24 +473,26 @@ static struct rtc_class_ops x1205_rtc_ops = { ...@@ -473,24 +473,26 @@ static struct rtc_class_ops x1205_rtc_ops = {
static ssize_t x1205_sysfs_show_atrim(struct device *dev, static ssize_t x1205_sysfs_show_atrim(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int atrim; int err, atrim;
if (x1205_get_atrim(to_i2c_client(dev), &atrim) == 0) err = x1205_get_atrim(to_i2c_client(dev), &atrim);
return sprintf(buf, "%d.%02d pF\n", if (err)
atrim / 1000, atrim % 1000); return err;
return 0;
return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
} }
static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL); static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL);
static ssize_t x1205_sysfs_show_dtrim(struct device *dev, static ssize_t x1205_sysfs_show_dtrim(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int dtrim; int err, dtrim;
if (x1205_get_dtrim(to_i2c_client(dev), &dtrim) == 0) err = x1205_get_dtrim(to_i2c_client(dev), &dtrim);
return sprintf(buf, "%d ppm\n", dtrim); if (err)
return err;
return 0; return sprintf(buf, "%d ppm\n", dtrim);
} }
static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, 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