[media] blackfin: check devm_pinctrl_get() for errors
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Jul 2016 10:18:14 +0000 (07:18 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 18 Nov 2016 16:22:27 +0000 (14:22 -0200)
devm_pinctrl_get() can fail so we should check for that.

Fixes: 0a6824bc10de ('[media] v4l2: blackfin: select proper pinctrl state in ppi_set_params if CONFIG_PINCTRL is enabled')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/blackfin/ppi.c

index cff63e511e6d9a99434deb6a2d776058018eb34e..b8f3d9fa66e907ca54c0e61972c5c2bbacfad2b5 100644 (file)
@@ -214,6 +214,8 @@ static int ppi_set_params(struct ppi_if *ppi, struct ppi_params *params)
        if (params->dlen > 24 || params->dlen <= 0)
                return -EINVAL;
        pctrl = devm_pinctrl_get(ppi->dev);
+       if (IS_ERR(pctrl))
+               return PTR_ERR(pctrl);
        pstate = pinctrl_lookup_state(pctrl,
                                      pin_state[(params->dlen + 7) / 8 - 1]);
        if (pinctrl_select_state(pctrl, pstate))