[media] V4L: sh_mobile_csi2: fix unbalanced pm_runtime_put()
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Fri, 9 Sep 2011 09:40:56 +0000 (06:40 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 3 Nov 2011 20:29:00 +0000 (18:29 -0200)
If the sh_mobile_csi2 driver didn't attach to a client, normally, because
the respective device connects to the SoC over the parallel CEU interface
and doesn't use the CSI-2 controller, it also shouldn't call
pm_runtime_put() on attempted disconnect.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/sh_mobile_csi2.c

index 91c680a728498ece068d4fc932ecc4744a1baba0..37706eb81f25efefa89669f79f3abfbbad09e452 100644 (file)
@@ -208,6 +208,9 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv)
        unsigned long common_flags, csi2_flags;
        int i, ret;
 
+       if (priv->client)
+               return -EBUSY;
+
        for (i = 0; i < pdata->num_clients; i++)
                if (&pdata->clients[i].pdev->dev == icd->pdev)
                        break;
@@ -262,6 +265,9 @@ static int sh_csi2_client_connect(struct sh_csi2 *priv)
 
 static void sh_csi2_client_disconnect(struct sh_csi2 *priv)
 {
+       if (!priv->client)
+               return;
+
        priv->client = NULL;
 
        pm_runtime_put(v4l2_get_subdevdata(&priv->subdev));