Commit a5b33e6a authored by Wolfram Sang's avatar Wolfram Sang Committed by Dmitry Torokhov

Input: lm8323 - do not leave dangling client data pointer

Do not leave dangling client data pointers when unbinding device from the
driver or when binding fails for some reason.
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent d6372b70
...@@ -670,8 +670,6 @@ static int __devinit lm8323_probe(struct i2c_client *client, ...@@ -670,8 +670,6 @@ static int __devinit lm8323_probe(struct i2c_client *client,
goto fail1; goto fail1;
} }
i2c_set_clientdata(client, lm);
lm->client = client; lm->client = client;
lm->idev = idev; lm->idev = idev;
mutex_init(&lm->lock); mutex_init(&lm->lock);
...@@ -753,6 +751,8 @@ static int __devinit lm8323_probe(struct i2c_client *client, ...@@ -753,6 +751,8 @@ static int __devinit lm8323_probe(struct i2c_client *client,
goto fail4; goto fail4;
} }
i2c_set_clientdata(client, lm);
device_init_wakeup(&client->dev, 1); device_init_wakeup(&client->dev, 1);
enable_irq_wake(client->irq); enable_irq_wake(client->irq);
...@@ -778,6 +778,8 @@ static int __devexit lm8323_remove(struct i2c_client *client) ...@@ -778,6 +778,8 @@ static int __devexit lm8323_remove(struct i2c_client *client)
struct lm8323_chip *lm = i2c_get_clientdata(client); struct lm8323_chip *lm = i2c_get_clientdata(client);
int i; int i;
i2c_set_clientdata(client, NULL);
disable_irq_wake(client->irq); disable_irq_wake(client->irq);
free_irq(client->irq, lm); free_irq(client->irq, lm);
cancel_work_sync(&lm->work); cancel_work_sync(&lm->work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment