diff options
author | Alessandro Zummo <a.zummo@towertech.it> | 2006-04-11 01:54:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:47 -0400 |
commit | 8289607249ad25ecfc9a3742873fcd8f319d5b09 (patch) | |
tree | c69bc65332554358fdd959136e2cb1e0f730ffef | |
parent | adfb4341259f2f89baac2316a8a3660b63c1103b (diff) |
[PATCH] RTC subsystem: RS5C372 sysfs fix
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>
-rw-r--r-- | drivers/rtc/rtc-rs5c372.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 48aecb890272..5e5cc10c675e 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -169,24 +169,26 @@ static struct rtc_class_ops rs5c372_rtc_ops = { | |||
169 | static ssize_t rs5c372_sysfs_show_trim(struct device *dev, | 169 | static ssize_t rs5c372_sysfs_show_trim(struct device *dev, |
170 | struct device_attribute *attr, char *buf) | 170 | struct device_attribute *attr, char *buf) |
171 | { | 171 | { |
172 | int trim; | 172 | int err, trim; |
173 | 173 | ||
174 | if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0) | 174 | err = rs5c372_get_trim(to_i2c_client(dev), NULL, &trim); |
175 | return sprintf(buf, "0x%2x\n", trim); | 175 | if (err) |
176 | return err; | ||
176 | 177 | ||
177 | return 0; | 178 | return sprintf(buf, "0x%2x\n", trim); |
178 | } | 179 | } |
179 | static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); | 180 | static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); |
180 | 181 | ||
181 | static ssize_t rs5c372_sysfs_show_osc(struct device *dev, | 182 | static ssize_t rs5c372_sysfs_show_osc(struct device *dev, |
182 | struct device_attribute *attr, char *buf) | 183 | struct device_attribute *attr, char *buf) |
183 | { | 184 | { |
184 | int osc; | 185 | int err, osc; |
185 | 186 | ||
186 | if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0) | 187 | err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL); |
187 | return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); | 188 | if (err) |
189 | return err; | ||
188 | 190 | ||
189 | return 0; | 191 | return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); |
190 | } | 192 | } |
191 | static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); | 193 | static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); |
192 | 194 | ||