From: Fabio Estevam <fabio.este...@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.carpen...@oracle.com>
Signed-off-by: Fabio Estevam <fabio.este...@freescale.com>
---
Changes since v2:
- None
Changes since v1:
- Check 'dmfc' prior to setting the priv pointer

 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 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..ce152d9 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
@@ -154,16 +154,18 @@ EXPORT_SYMBOL_GPL(ipu_dmfc_disable_channel);
 static int ipu_dmfc_setup_channel(struct dmfc_channel *dmfc, int slots,
                int segment, int burstsize)
 {
-       struct ipu_dmfc_priv *priv = dmfc->priv;
+       struct ipu_dmfc_priv *priv;
        u32 val, field;
 
+       if (!dmfc)
+               return -EINVAL;
+
+       priv = dmfc->priv;
+
        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

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to