summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rs5c372.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-12-06 20:35:34 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 08:39:31 -0800
commit91046a8a693823d434f0aa70419c48ebeb8e1b11 (patch)
tree10eb9325fa0a929f00b24485ad3031726c8ba57d /drivers/rtc/rtc-rs5c372.c
parentbfc7ee207078e8ca51264355805e6f56b485be4b (diff)
downloadlinux-91046a8a693823d434f0aa70419c48ebeb8e1b11.tar.bz2
[PATCH] RTC: handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
-rw-r--r--drivers/rtc/rtc-rs5c372.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index a44fe4efa216..9e1bb3a72f7a 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -238,11 +238,19 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind)
i2c_set_clientdata(client, rtc);
- device_create_file(&client->dev, &dev_attr_trim);
- device_create_file(&client->dev, &dev_attr_osc);
+ err = device_create_file(&client->dev, &dev_attr_trim);
+ if (err) goto exit_devreg;
+ err = device_create_file(&client->dev, &dev_attr_osc);
+ if (err) goto exit_trim;
return 0;
+exit_trim:
+ device_remove_file(&client->dev, &dev_attr_trim);
+
+exit_devreg:
+ rtc_device_unregister(rtc);
+
exit_detach:
i2c_detach_client(client);