aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-12-06 23:35:34 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:31 -0500
commit91046a8a693823d434f0aa70419c48ebeb8e1b11 (patch)
tree10eb9325fa0a929f00b24485ad3031726c8ba57d /drivers/rtc
parentbfc7ee207078e8ca51264355805e6f56b485be4b (diff)
[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')
-rw-r--r--drivers/rtc/rtc-ds1672.c9
-rw-r--r--drivers/rtc/rtc-rs5c372.c12
-rw-r--r--drivers/rtc/rtc-test.c9
-rw-r--r--drivers/rtc/rtc-x1205.c12
4 files changed, 35 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
index 67e816a9a39f..dfef1637bfb8 100644
--- a/drivers/rtc/rtc-ds1672.c
+++ b/drivers/rtc/rtc-ds1672.c
@@ -237,17 +237,22 @@ static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind)
237 /* read control register */ 237 /* read control register */
238 err = ds1672_get_control(client, &control); 238 err = ds1672_get_control(client, &control);
239 if (err) 239 if (err)
240 goto exit_detach; 240 goto exit_devreg;
241 241
242 if (control & DS1672_REG_CONTROL_EOSC) 242 if (control & DS1672_REG_CONTROL_EOSC)
243 dev_warn(&client->dev, "Oscillator not enabled. " 243 dev_warn(&client->dev, "Oscillator not enabled. "
244 "Set time to enable.\n"); 244 "Set time to enable.\n");
245 245
246 /* Register sysfs hooks */ 246 /* Register sysfs hooks */
247 device_create_file(&client->dev, &dev_attr_control); 247 err = device_create_file(&client->dev, &dev_attr_control);
248 if (err)
249 goto exit_devreg;
248 250
249 return 0; 251 return 0;
250 252
253exit_devreg:
254 rtc_device_unregister(rtc);
255
251exit_detach: 256exit_detach:
252 i2c_detach_client(client); 257 i2c_detach_client(client);
253 258
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)
238 238
239 i2c_set_clientdata(client, rtc); 239 i2c_set_clientdata(client, rtc);
240 240
241 device_create_file(&client->dev, &dev_attr_trim); 241 err = device_create_file(&client->dev, &dev_attr_trim);
242 device_create_file(&client->dev, &dev_attr_osc); 242 if (err) goto exit_devreg;
243 err = device_create_file(&client->dev, &dev_attr_osc);
244 if (err) goto exit_trim;
243 245
244 return 0; 246 return 0;
245 247
248exit_trim:
249 device_remove_file(&client->dev, &dev_attr_trim);
250
251exit_devreg:
252 rtc_device_unregister(rtc);
253
246exit_detach: 254exit_detach:
247 i2c_detach_client(client); 255 i2c_detach_client(client);
248 256
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 6ef9c62d5032..f50a1b8e1607 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -123,11 +123,18 @@ static int test_probe(struct platform_device *plat_dev)
123 err = PTR_ERR(rtc); 123 err = PTR_ERR(rtc);
124 return err; 124 return err;
125 } 125 }
126 device_create_file(&plat_dev->dev, &dev_attr_irq); 126
127 err = device_create_file(&plat_dev->dev, &dev_attr_irq);
128 if (err)
129 goto err;
127 130
128 platform_set_drvdata(plat_dev, rtc); 131 platform_set_drvdata(plat_dev, rtc);
129 132
130 return 0; 133 return 0;
134
135err:
136 rtc_device_unregister(rtc);
137 return err;
131} 138}
132 139
133static int __devexit test_remove(struct platform_device *plat_dev) 140static int __devexit test_remove(struct platform_device *plat_dev)
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 522c69753bbf..9a67487d086b 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -562,11 +562,19 @@ static int x1205_probe(struct i2c_adapter *adapter, int address, int kind)
562 else 562 else
563 dev_err(&client->dev, "couldn't read status\n"); 563 dev_err(&client->dev, "couldn't read status\n");
564 564
565 device_create_file(&client->dev, &dev_attr_atrim); 565 err = device_create_file(&client->dev, &dev_attr_atrim);
566 device_create_file(&client->dev, &dev_attr_dtrim); 566 if (err) goto exit_devreg;
567 err = device_create_file(&client->dev, &dev_attr_dtrim);
568 if (err) goto exit_atrim;
567 569
568 return 0; 570 return 0;
569 571
572exit_atrim:
573 device_remove_file(&client->dev, &dev_attr_atrim);
574
575exit_devreg:
576 rtc_device_unregister(rtc);
577
570exit_detach: 578exit_detach:
571 i2c_detach_client(client); 579 i2c_detach_client(client);
572 580