All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <dmitry.torokhov@gmail.com>, <lars@metafoo.de>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	kbuild test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH v4 4/4] Input: adp5589: fix possible memleak of 'kpad'
Date: Thu, 5 Mar 2020 15:14:05 +0200	[thread overview]
Message-ID: <20200305131405.6598-4-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20200305131405.6598-1-alexandru.ardelean@analog.com>

If 'adp5589_i2c_get_driver_data()' returns an error, the exit path should
be to also free the 'kpad' object.
This change fixes that.

Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/input/keyboard/adp5589-keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 1fd36c581a91..5cef5a13b776 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -1050,7 +1050,7 @@ static int adp5589_probe(struct i2c_client *client,
 
 	ret = adp5589_i2c_get_driver_data(client, id);
 	if (ret < 0)
-		return ret;
+		goto err_free_mem;
 
 	switch (ret) {
 	case ADP5585_02:
-- 
2.20.1


  parent reply	other threads:[~2020-03-05 13:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 13:14 [PATCH v4 1/4] Input: adp5589: Add default platform data Alexandru Ardelean
2020-03-05 13:14 ` [PATCH v4 2/4] Input: adp5589: Add basic devicetree support Alexandru Ardelean
2020-03-05 13:14 ` [PATCH v4 3/4] Input: adp5589: unify ret & error variables Alexandru Ardelean
2020-03-05 13:29   ` Dan Carpenter
2020-03-05 13:14 ` Alexandru Ardelean [this message]
2020-04-01 14:05 ` [PATCH v4 1/4] Input: adp5589: Add default platform data Ardelean, Alexandru

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=20200305131405.6598-4-alexandru.ardelean@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.