media: rcar-csi2: Cleanup mutex on remove and fail
The mutex was not destroyed on remove or failed probe, fix this. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
164646a785
commit
984166720e
|
@ -1421,14 +1421,14 @@ static int rcsi2_probe(struct platform_device *pdev)
|
|||
ret = rcsi2_probe_resources(priv, pdev);
|
||||
if (ret) {
|
||||
dev_err(priv->dev, "Failed to get resources\n");
|
||||
return ret;
|
||||
goto error_mutex;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
ret = rcsi2_parse_dt(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto error_mutex;
|
||||
|
||||
priv->subdev.owner = THIS_MODULE;
|
||||
priv->subdev.dev = &pdev->dev;
|
||||
|
@ -1450,21 +1450,23 @@ static int rcsi2_probe(struct platform_device *pdev)
|
|||
ret = media_entity_pads_init(&priv->subdev.entity, num_pads,
|
||||
priv->pads);
|
||||
if (ret)
|
||||
goto error;
|
||||
goto error_async;
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
ret = v4l2_async_register_subdev(&priv->subdev);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
goto error_async;
|
||||
|
||||
dev_info(priv->dev, "%d lanes found\n", priv->lanes);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
error_async:
|
||||
v4l2_async_nf_unregister(&priv->notifier);
|
||||
v4l2_async_nf_cleanup(&priv->notifier);
|
||||
error_mutex:
|
||||
mutex_destroy(&priv->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1479,6 +1481,8 @@ static int rcsi2_remove(struct platform_device *pdev)
|
|||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
mutex_destroy(&priv->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue