[PATCH 1/6] imx-drm: ipu-dmfc: Check 'dmfc' pointer first

Fabio Estevam festevam at gmail.com
Wed Feb 26 21:44:34 UTC 2014


From: Fabio Estevam <fabio.estevam at freescale.com>

Fix the following static checker warning:

drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c:164 ipu_dmfc_setup_channel() warn: variable dereferenced before check 'dmfc' (see line 157)

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
index 98070dd..76542d3 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
@@ -157,13 +157,13 @@ static int ipu_dmfc_setup_channel(struct dmfc_channel *dmfc, int slots,
 	struct ipu_dmfc_priv *priv = dmfc->priv;
 	u32 val, field;
 
+	if (!dmfc)
+		return -EINVAL;
+
 	dev_dbg(priv->dev,
 			"dmfc: using %d slots starting from segment %d for IPU channel %d\n",
 			slots, segment, dmfc->data->ipu_channel);
 
-	if (!dmfc)
-		return -EINVAL;
-
 	switch (slots) {
 	case 1:
 		field = DMFC_FIFO_SIZE_64;
-- 
1.8.1.2



More information about the devel mailing list