[v4,4/4] Input: adp5589: fix possible memleak of 'kpad'
diff mbox series

Message ID 20200305131405.6598-4-alexandru.ardelean@analog.com
State New
Headers show
Series
  • [v4,1/4] Input: adp5589: Add default platform data
Related show

Commit Message

Ardelean, Alexandru March 5, 2020, 1:14 p.m. UTC
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(-)

Patch
diff mbox series

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: