Skip to content

Commit

Permalink
Input: lm8323 - do not leave dangling client data pointer
Browse files Browse the repository at this point in the history
Do not leave dangling client data pointers when unbinding device from the
driver or when binding fails for some reason.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Wolfram Sang authored and Dmitry Torokhov committed Apr 14, 2010
1 parent d6372b7 commit a5b33e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/input/keyboard/lm8323.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,6 @@ static int __devinit lm8323_probe(struct i2c_client *client,
goto fail1;
}

i2c_set_clientdata(client, lm);

lm->client = client;
lm->idev = idev;
mutex_init(&lm->lock);
Expand Down Expand Up @@ -753,6 +751,8 @@ static int __devinit lm8323_probe(struct i2c_client *client,
goto fail4;
}

i2c_set_clientdata(client, lm);

device_init_wakeup(&client->dev, 1);
enable_irq_wake(client->irq);

Expand All @@ -778,6 +778,8 @@ static int __devexit lm8323_remove(struct i2c_client *client)
struct lm8323_chip *lm = i2c_get_clientdata(client);
int i;

i2c_set_clientdata(client, NULL);

disable_irq_wake(client->irq);
free_irq(client->irq, lm);
cancel_work_sync(&lm->work);
Expand Down

0 comments on commit a5b33e6

Please sign in to comment.