diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-11-08 19:24:18 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-12-10 08:08:45 -0500 |
commit | cc58f4db5173f5cd039de4681ec4778b5cd71182 (patch) | |
tree | af7e793c5436620b13f51c54cc31c7406eeed2da | |
parent | eed8c3eebce72fe4fc766f9a23e4324b04bd86cf (diff) |
[media] media: i2c: lm3560: use correct clientdata in lm3560_remove()
We had set the i2c clientdata to &flash->subdev_led[LM3560_LED1]
after call lm3560_subdev_init(flash, LM3560_LED1, "lm3560-led1"),
but the container_of() in lm3560_remove() return the wrong pointer
to flash.(should be container_of(subdev, struct lm3560_flash,
subdev_led[LM3560_LED_MAX-1])
This patch fix to set i2c clientdata to flash so we can get flash
from clientdata directly.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/i2c/lm3560.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index e728d9fb08d1..d98ca3aebe23 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c | |||
@@ -448,14 +448,14 @@ static int lm3560_probe(struct i2c_client *client, | |||
448 | if (rval < 0) | 448 | if (rval < 0) |
449 | return rval; | 449 | return rval; |
450 | 450 | ||
451 | i2c_set_clientdata(client, flash); | ||
452 | |||
451 | return 0; | 453 | return 0; |
452 | } | 454 | } |
453 | 455 | ||
454 | static int lm3560_remove(struct i2c_client *client) | 456 | static int lm3560_remove(struct i2c_client *client) |
455 | { | 457 | { |
456 | struct v4l2_subdev *subdev = i2c_get_clientdata(client); | 458 | struct lm3560_flash *flash = i2c_get_clientdata(client); |
457 | struct lm3560_flash *flash = container_of(subdev, struct lm3560_flash, | ||
458 | subdev_led[LM3560_LED_MAX]); | ||
459 | unsigned int i; | 459 | unsigned int i; |
460 | 460 | ||
461 | for (i = LM3560_LED0; i < LM3560_LED_MAX; i++) { | 461 | for (i = LM3560_LED0; i < LM3560_LED_MAX; i++) { |