]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] RTC subsystem: RS5C372 sysfs fix
authorAlessandro Zummo <a.zummo@towertech.it>
Tue, 11 Apr 2006 05:54:44 +0000 (22:54 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 11 Apr 2006 13:18:47 +0000 (06:18 -0700)
Fix sysfs show() return code

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/rtc/rtc-rs5c372.c

index 48aecb8902723f503a5f87dd591a06357b0b94c8..5e5cc10c675e71fa3f68298511491f27637a926f 100644 (file)
@@ -169,24 +169,26 @@ static struct rtc_class_ops rs5c372_rtc_ops = {
 static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
                                struct device_attribute *attr, char *buf)
 {
-       int trim;
+       int err, trim;
 
-       if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0)
-               return sprintf(buf, "0x%2x\n", trim);
+       err = rs5c372_get_trim(to_i2c_client(dev), NULL, &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 ssize_t rs5c372_sysfs_show_osc(struct device *dev,
                                struct device_attribute *attr, char *buf)
 {
-       int osc;
+       int err, osc;
 
-       if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0)
-               return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
+       err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL);
+       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);