summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/nxp/pinctrl-imx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/nxp/pinctrl-imx.c')
-rw-r--r--drivers/pinctrl/nxp/pinctrl-imx.c5
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;
}