Skip to content

Commit 8289607

Browse files
Alessandro ZummoLinus Torvalds
authored andcommitted
[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>
1 parent adfb434 commit 8289607

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

‎drivers/rtc/rtc-rs5c372.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,26 @@ static struct rtc_class_ops rs5c372_rtc_ops = {
169169
static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
170170
struct device_attribute *attr, char *buf)
171171
{
172-
int trim;
172+
int err, trim;
173173

174-
if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0)
175-
return sprintf(buf, "0x%2x\n", trim);
174+
err = rs5c372_get_trim(to_i2c_client(dev), NULL, &trim);
175+
if (err)
176+
return err;
176177

177-
return 0;
178+
return sprintf(buf, "0x%2x\n", trim);
178179
}
179180
static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL);
180181

181182
static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
182183
struct device_attribute *attr, char *buf)
183184
{
184-
int osc;
185+
int err, osc;
185186

186-
if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0)
187-
return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
187+
err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL);
188+
if (err)
189+
return err;
188190

189-
return 0;
191+
return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
190192
}
191193
static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL);
192194

0 commit comments

Comments
 (0)