media: atmel: atmel-isc: fix and cleanup potential bugs

Fixed issues that can lead to potential bugs.
Cleanup order in the driver
Taking into consideration std control creation can fail
mutex_destroy call
changing controller_formats with const specifier
some cosmetic cleanups

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Eugen Hristev
2019-06-12 08:00:35 -04:00
committed by Mauro Carvalho Chehab
parent 0a0e265515
commit b046ec51f9
3 changed files with 29 additions and 15 deletions

View File

@@ -122,8 +122,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
ISC_PFE_CFG0_CCIR656;
subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
subdev_entity->asd->match.fwnode =
of_fwnode_handle(rem);
subdev_entity->asd->match.fwnode = of_fwnode_handle(rem);
list_add_tail(&subdev_entity->list, &isc->subdev_entities);
}
@@ -282,13 +281,14 @@ static int atmel_isc_remove(struct platform_device *pdev)
struct isc_device *isc = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(isc->ispck);
clk_disable_unprepare(isc->hclock);
isc_subdev_cleanup(isc);
v4l2_device_unregister(&isc->v4l2_dev);
clk_disable_unprepare(isc->ispck);
clk_disable_unprepare(isc->hclock);
isc_clk_cleanup(isc);
return 0;
@@ -313,7 +313,11 @@ static int __maybe_unused isc_runtime_resume(struct device *dev)
if (ret)
return ret;
return clk_prepare_enable(isc->ispck);
ret = clk_prepare_enable(isc->ispck);
if (ret)
clk_disable_unprepare(isc->hclock);
return ret;
}
static const struct dev_pm_ops atmel_isc_dev_pm_ops = {