[PATCH 1/4] pinctrl: imx-iomux-v3: fix compiler warning

Roland Hieber r.hieber at pengutronix.de
Sun Sep 2 14:21:20 PDT 2018


From: Roland Hieber <rohieb at rohieb.name>

Fix a warning while compiling with GCC 5.4.0 (OSELAS.Toolchain 2016.02):

    drivers/pinctrl/imx-iomux-v3.c: In function 'imx_iomux_v3_set_state':
    drivers/pinctrl/imx-iomux-v3.c:153:13: warning: 'share_conf_val' may be used uninitialized in this function [-Wmaybe-uninitialized]
        conf_val &= ~IMX_PAD_SION;
                 ^
The relevant code section at line 153 is:

148:		u32 conf_val = share_conf ?
149:			share_conf_val : be32_to_cpu(*list++);
150:
151:		if (conf_val & IMX_PAD_SION) {
152:			mux_val |= IOMUXC_CONFIG_SION;
153:			conf_val &= ~IMX_PAD_SION;
154:		}

share_conf_val is only initialized in an if branch above that section.

Signed-off-by: Roland Hieber <rohieb at rohieb.name>
---
 drivers/pinctrl/imx-iomux-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/imx-iomux-v3.c b/drivers/pinctrl/imx-iomux-v3.c
index d176199c52..0ab97040e0 100644
--- a/drivers/pinctrl/imx-iomux-v3.c
+++ b/drivers/pinctrl/imx-iomux-v3.c
@@ -87,7 +87,7 @@ static int imx_iomux_v3_set_state(struct pinctrl_device *pdev, struct device_nod
 	const bool share_conf = iomux->flags & SHARE_CONF;
 	int npins, size, i, fsl_pin_size;
 	const char *name;
-	u32 share_conf_val;
+	u32 share_conf_val = 0;
 
 	dev_dbg(iomux->pinctrl.dev, "set state: %s\n", np->full_name);
 
-- 
2.18.0




More information about the barebox mailing list