Skip to content

Commit

Permalink
[media] V4L: sh_mobile_csi2: fix unbalanced pm_runtime_put()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Nov 3, 2011
1 parent 443f483 commit 2fbdc9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/video/sh_mobile_csi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 2fbdc9b

Please sign in to comment.