diff options
author | Peng Fan <peng.fan@nxp.com> | 2017-05-10 08:44:04 +0800 |
---|---|---|
committer | Peng Fan <peng.fan@nxp.com> | 2017-05-11 13:41:38 +0800 |
commit | aad973c1d782f12128eca14214b11b08d2a7f1f7 (patch) | |
tree | ec1eb1dd3c74866584295e6bd762f1b2ba779584 /drivers/pinctrl | |
parent | 16270556212e6c7422e87f69572c90f1afe6998b (diff) | |
download | u-boot-imx-aad973c1d782f12128eca14214b11b08d2a7f1f7.zip u-boot-imx-aad973c1d782f12128eca14214b11b08d2a7f1f7.tar.gz u-boot-imx-aad973c1d782f12128eca14214b11b08d2a7f1f7.tar.bz2 |
MLK-14840: pinctrl: imx: fix resource leak
The device managed API actually not free the memory, so need
to use devm_kfree to free the memory to avoid leakage.
Coverity: 392384 resource leak
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/nxp/pinctrl-imx.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c index 9b80d50..e29e241 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx.c +++ b/drivers/pinctrl/nxp/pinctrl-imx.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 Peng Fan <van.freenix@gmail.com> + * Copyright 2017 NXP * * SPDX-License-Identifier: GPL-2.0+ */ @@ -53,6 +54,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config) if (fdtdec_get_int_array(gd->fdt_blob, node, "fsl,pins", pin_data, size >> 2)) { dev_err(dev, "Error reading pin data.\n"); + devm_kfree(dev, pin_data); return -EINVAL; } @@ -78,6 +80,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config) if ((mux_reg == -1) || (conf_reg == -1)) { dev_err(dev, "Error mux_reg or conf_reg\n"); + devm_kfree(dev, pin_data); return -EINVAL; } @@ -166,6 +169,8 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config) } } + devm_kfree(dev, pin_data); + return 0; } |