From patchwork Sat Nov 9 00:24:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3160931 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 479BA9F243 for ; Sat, 9 Nov 2013 00:24:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E084B2047C for ; Sat, 9 Nov 2013 00:24:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C11E420460 for ; Sat, 9 Nov 2013 00:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757577Ab3KIAYU (ORCPT ); Fri, 8 Nov 2013 19:24:20 -0500 Received: from mail-bk0-f44.google.com ([209.85.214.44]:34146 "EHLO mail-bk0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751087Ab3KIAYU (ORCPT ); Fri, 8 Nov 2013 19:24:20 -0500 Received: by mail-bk0-f44.google.com with SMTP id mx12so60088bkb.31 for ; Fri, 08 Nov 2013 16:24:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=EwbWNuq75YP6rmCUxTe/ETCdZZLuFfwRy0TePxhFkHk=; b=lY+UftjEh8gP+RftiJUonjQWvponkUDlkZvXJiTbqUYYmSV/vavB0VnKO9wXxyFanG eL2TXBalkuZ41ccus4CITjV3Z+/wJOjdTJ6Wl+wtM1Re+nmz4pSzMzq1founuWmv0mkB LeqjFHLPNs0uSV9Q7kqEvbDP7Ui+DTfRaI9H3rkC8ekcbv4FsT3Rzt8rjHJ3WEsI1h3r wDWETXPb+Pa8KPQxCD6jtH6+pxCh02nLXcVFIKJWQqT1WMjdrIhc7D7aUXBndX6rpCWV UblRY5MxKCZu0OQWUtZBURHa8sBKugPS0VRd2DWj88hUhcEXYkINai6sM49Q4E7uH1s/ Djqw== MIME-Version: 1.0 X-Received: by 10.205.76.133 with SMTP id ze5mr328699bkb.37.1383956658958; Fri, 08 Nov 2013 16:24:18 -0800 (PST) Received: by 10.205.19.10 with HTTP; Fri, 8 Nov 2013 16:24:18 -0800 (PST) Date: Sat, 9 Nov 2013 08:24:18 +0800 Message-ID: Subject: [PATCH -next] [media] media: i2c: lm3560: use correct clientdata in lm3560_remove() From: Wei Yongjun To: m.chehab@samsung.com, gshark.jeong@gmail.com Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun 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 --- drivers/media/i2c/lm3560.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c index 3317a9a..5a70d71 100644 --- a/drivers/media/i2c/lm3560.c +++ b/drivers/media/i2c/lm3560.c @@ -444,14 +444,14 @@ static int lm3560_probe(struct i2c_client *client, if (rval < 0) return rval; + i2c_set_clientdata(client, flash); + return 0; } static int lm3560_remove(struct i2c_client *client) { - struct v4l2_subdev *subdev = i2c_get_clientdata(client); - struct lm3560_flash *flash = container_of(subdev, struct lm3560_flash, - subdev_led[LM3560_LED_MAX]); + struct lm3560_flash *flash = i2c_get_clientdata(client); unsigned int i; for (i = LM3560_LED0; i < LM3560_LED_MAX; i++) {