aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-04-28 05:11:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:17 -0400
commite2bfe3424b368e977002fc58f81536d5d8ea9449 (patch)
tree6bdc0c1dbf189ce7b8c4f7e74db2ef40cbf97ec9 /drivers/rtc
parente275ac477161a3df5c27e40c55f7af94cfb396cf (diff)
rtc: rtc-rs5c372: fix up NULL name in transfer error path
rs5c_get_regs() currently uses rs5c->rtc->name for its debug printk when i2c_transfer() fails, though it is used several times before the rtc dev has been registered. The earliest we can get at the symbolic name is via the i2c client's struct device, which can be handled by moving the first rs5c_get_regs() until after the client pointer is assigned. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Cc: David Brownell <david-b@pacbell.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-rs5c372.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 6b67b5097927..67d8768c1b64 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -99,7 +99,7 @@ static int rs5c_get_regs(struct rs5c372 *rs5c)
99 * least 80219 chips; this works around that bug. 99 * least 80219 chips; this works around that bug.
100 */ 100 */
101 if ((i2c_transfer(client->adapter, msgs, 1)) != 1) { 101 if ((i2c_transfer(client->adapter, msgs, 1)) != 1) {
102 pr_debug("%s: can't read registers\n", rs5c->rtc->name); 102 dev_warn(&client->dev, "can't read registers\n");
103 return -EIO; 103 return -EIO;
104 } 104 }
105 105
@@ -512,12 +512,12 @@ static int rs5c372_probe(struct i2c_client *client)
512 goto exit; 512 goto exit;
513 } 513 }
514 514
515 /* we read registers 0x0f then 0x00-0x0f; skip the first one */
516 rs5c372->regs=&rs5c372->buf[1];
517
518 rs5c372->client = client; 515 rs5c372->client = client;
519 i2c_set_clientdata(client, rs5c372); 516 i2c_set_clientdata(client, rs5c372);
520 517
518 /* we read registers 0x0f then 0x00-0x0f; skip the first one */
519 rs5c372->regs = &rs5c372->buf[1];
520
521 err = rs5c_get_regs(rs5c372); 521 err = rs5c_get_regs(rs5c372);
522 if (err < 0) 522 if (err < 0)
523 goto exit_kfree; 523 goto exit_kfree;