linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Cox <alan@linux.intel.com>,
	linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] Staging: atomisp: kfreeing a devm allocated pointer
Date: Tue, 14 Mar 2017 10:53:52 +0300	[thread overview]
Message-ID: <20170314075352.GA6274@mwanda> (raw)

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 <dan.carpenter@oracle.com>

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;
 		}

                 reply	other threads:[~2017-03-14  7:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170314075352.GA6274@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).