From patchwork Tue Mar 14 07:53:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9622627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90D9260244 for ; Tue, 14 Mar 2017 07:55:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E5FA284CE for ; Tue, 14 Mar 2017 07:55:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FB24284EF; Tue, 14 Mar 2017 07:55:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9D2E284A3 for ; Tue, 14 Mar 2017 07:55:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750895AbdCNHzK (ORCPT ); Tue, 14 Mar 2017 03:55:10 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:28547 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbdCNHzJ (ORCPT ); Tue, 14 Mar 2017 03:55:09 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v2E7sXrH021649 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 Mar 2017 07:54:33 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v2E7sW1H004212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 Mar 2017 07:54:32 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v2E7sW21009685; Tue, 14 Mar 2017 07:54:32 GMT Received: from mwanda (/154.0.138.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Mar 2017 00:54:31 -0700 Date: Tue, 14 Mar 2017 10:53:52 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org Subject: [patch] Staging: atomisp: kfreeing a devm allocated pointer Message-ID: <20170314075352.GA6274@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We shouldn't pass devm allocated pointers to kfree() or it leads to a double free. Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Signed-off-by: Dan Carpenter diff --git a/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c b/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c index 242e934a6030..b11f90c5960c 100644 --- a/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c +++ b/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c @@ -69,7 +69,6 @@ void *brcc064_otp_read(struct v4l2_subdev *sd, u8 dev_addr, r = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); if (r != ARRAY_SIZE(msg)) { - kfree(buffer); dev_err(&client->dev, "read failed at 0x%03x\n", addr); return NULL; } diff --git a/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c b/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c index ce4e7ab7781c..73d041f97811 100644 --- a/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c +++ b/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c @@ -79,7 +79,6 @@ void *e2prom_otp_read(struct v4l2_subdev *sd, u8 dev_addr, r = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); if (r != ARRAY_SIZE(msg)) { - kfree(buffer); dev_err(&client->dev, "read failed at 0x%03x\n", addr); return NULL; }