Skip to content

Commit

Permalink
rtc: rtc-rs5c372: fix up NULL name in transfer error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mundt authored and Linus Torvalds committed Apr 28, 2008
1 parent e275ac4 commit e2bfe34
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/rtc/rtc-rs5c372.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int rs5c_get_regs(struct rs5c372 *rs5c)
* least 80219 chips; this works around that bug.
*/
if ((i2c_transfer(client->adapter, msgs, 1)) != 1) {
pr_debug("%s: can't read registers\n", rs5c->rtc->name);
dev_warn(&client->dev, "can't read registers\n");
return -EIO;
}

Expand Down Expand Up @@ -512,12 +512,12 @@ static int rs5c372_probe(struct i2c_client *client)
goto exit;
}

/* we read registers 0x0f then 0x00-0x0f; skip the first one */
rs5c372->regs=&rs5c372->buf[1];

rs5c372->client = client;
i2c_set_clientdata(client, rs5c372);

/* we read registers 0x0f then 0x00-0x0f; skip the first one */
rs5c372->regs = &rs5c372->buf[1];

err = rs5c_get_regs(rs5c372);
if (err < 0)
goto exit_kfree;
Expand Down

0 comments on commit e2bfe34

Please sign in to comment.