diff options
author | Alessandro Zummo <a.zummo@towertech.it> | 2014-04-03 17:49:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:16 -0400 |
commit | 4071ea25cc08d41002746cca2d69ac700d67a2ac (patch) | |
tree | 43cf44f8265b885c8c1e4e81f0ced5c6babb53c7 /drivers/rtc/rtc-ds1672.c | |
parent | a68b31080912dae377bee4994716b357dc74286d (diff) |
rtc: fix potential race condition
RTC drivers must not return an error after device registration.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Reported-by: Ales Novak <alnovak@suse.cz>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-ds1672.c')
-rw-r--r-- | drivers/rtc/rtc-ds1672.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c index 18e2d8471472..a4888dbca2e1 100644 --- a/drivers/rtc/rtc-ds1672.c +++ b/drivers/rtc/rtc-ds1672.c | |||
@@ -177,8 +177,9 @@ static int ds1672_probe(struct i2c_client *client, | |||
177 | 177 | ||
178 | /* read control register */ | 178 | /* read control register */ |
179 | err = ds1672_get_control(client, &control); | 179 | err = ds1672_get_control(client, &control); |
180 | if (err) | 180 | if (err) { |
181 | goto exit_devreg; | 181 | dev_warn(&client->dev, "Unable to read the control register\n"); |
182 | } | ||
182 | 183 | ||
183 | if (control & DS1672_REG_CONTROL_EOSC) | 184 | if (control & DS1672_REG_CONTROL_EOSC) |
184 | dev_warn(&client->dev, "Oscillator not enabled. " | 185 | dev_warn(&client->dev, "Oscillator not enabled. " |
@@ -187,12 +188,10 @@ static int ds1672_probe(struct i2c_client *client, | |||
187 | /* Register sysfs hooks */ | 188 | /* Register sysfs hooks */ |
188 | err = device_create_file(&client->dev, &dev_attr_control); | 189 | err = device_create_file(&client->dev, &dev_attr_control); |
189 | if (err) | 190 | if (err) |
190 | goto exit_devreg; | 191 | dev_err(&client->dev, "Unable to create sysfs entry: %s\n", |
192 | dev_attr_control.attr.name); | ||
191 | 193 | ||
192 | return 0; | 194 | return 0; |
193 | |||
194 | exit_devreg: | ||
195 | return err; | ||
196 | } | 195 | } |
197 | 196 | ||
198 | static struct i2c_device_id ds1672_id[] = { | 197 | static struct i2c_device_id ds1672_id[] = { |