media: imx-pxp: Check the return value from clk_prepare_enable()
Subsystems (2)
Fabio Estevam
reviewerPATCH v3 1/3 media: imx-pxp: Check the return value from clk_prepare_enable()
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error.
Signed-off-by Fabio Estevam <[email protected]>
Reviewed-by Philipp Zabel <[email protected]>
---
Changes since v2:
- None
drivers/media/platform/imx-pxp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/imx-pxp.c +4 -1
@@ -1666,7 +1666,10 @@ static int pxp_probe(struct platform_device *pdev)return ret; } -clk_prepare_enable (dev->clk); + ret =clk_prepare_enable (dev->clk); +if (ret <0 ) +return ret; +pxp_soft_reset (dev);spin_lock_init (&dev->irqlock);
Signature · 1 line
2.7.4
Fabio Estevam
reviewerPATCH v3 2/3 media: imx-pxp: Check for pxp_soft_reset() error
pxp_soft_reset() may fail with a timeout, so it is better to propagate the error in this case.
Signed-off-by Fabio Estevam <[email protected]>
Reviewed-by Philipp Zabel <[email protected]>
---
Changes since v2:
- Jump to err_clck when pxp_soft_reset() fails. (Philipp)
drivers/media/platform/imx-pxp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/media/platform/imx-pxp.c +9 -3
@@ -1607,7 +1607,7 @@ static const struct v4l2_m2m_ops m2m_ops = { .job_abort = pxp_job_abort, }; -static void pxp_soft_reset (struct pxp_dev *dev) +static int pxp_soft_reset (struct pxp_dev *dev) {int ret;u32 val;
@@ -1619,11 +1619,15 @@ static void pxp_soft_reset(struct pxp_dev *dev) ret =readl_poll_timeout (dev->mmio +HW_PXP_CTRL , val, val &BM_PXP_CTRL_CLKGATE ,0 ,100 ); -if (ret <0 ) +if (ret <0 ) {pr_err ("PXP reset timeout\n" ); +return ret; + }writel (BM_PXP_CTRL_SFTRST , dev->mmio +HW_PXP_CTRL_CLR );writel (BM_PXP_CTRL_CLKGATE , dev->mmio +HW_PXP_CTRL_CLR ); + +return 0 ; }static int pxp_probe (struct platform_device *pdev)
@@ -1670,7 +1674,9 @@ static int pxp_probe(struct platform_device *pdev)if (ret <0 )return ret; -pxp_soft_reset (dev); + ret =pxp_soft_reset (dev); +if (ret <0 ) + goto err_clk;spin_lock_init (&dev->irqlock);
Signature · 1 line
2.7.4
Fabio Estevam
reviewerPATCH v3 3/3 media: imx-pxp: Improve pxp_soft_reset() error message
In reply to Fabio EstevamImprove the pxp_soft_reset() error message by moving it to the caller function, associating it with a proper device and also by displaying the error code.
Signed-off-by Fabio Estevam <[email protected]>
Reviewed-by Philipp Zabel <[email protected]>
---
Changes since v2:
- None (only rebased against the change made in 2/3)
drivers/media/platform/imx-pxp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/imx-pxp.c +4 -4
@@ -1619,10 +1619,8 @@ static int pxp_soft_reset(struct pxp_dev *dev) ret =readl_poll_timeout (dev->mmio +HW_PXP_CTRL , val, val &BM_PXP_CTRL_CLKGATE ,0 ,100 ); -if (ret <0 ) { -pr_err ("PXP reset timeout\n" ); +if (ret <0 )return ret; - }writel (BM_PXP_CTRL_SFTRST , dev->mmio +HW_PXP_CTRL_CLR );writel (BM_PXP_CTRL_CLKGATE , dev->mmio +HW_PXP_CTRL_CLR );
@@ -1675,8 +1673,10 @@ static int pxp_probe(struct platform_device *pdev)return ret; ret =pxp_soft_reset (dev); -if (ret <0 ) +if (ret <0 ) { +dev_err (&pdev->dev,"PXP reset timeout: %d\n" , ret); goto err_clk; + }spin_lock_init (&dev->irqlock);
Signature · 1 line
2.7.4