From efceb765ff1df6d0ce0d024de5fe66bd7bb241da Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 6 Nov 2018 05:16:03 -0500 Subject: 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 Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/imx-pxp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/media/platform/imx-pxp.c') diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index b76cd0e8313c..27780f174c44 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -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); -- cgit v1.2.3 From e03eb362103b0b11ee210186675e835351866cb4 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 6 Nov 2018 05:16:04 -0500 Subject: 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 Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/imx-pxp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/media/platform/imx-pxp.c') diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index 27780f174c44..986764de5616 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -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); -- cgit v1.2.3 From 3431ebe5a6c0ec665f25464183c7a810e483dee8 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 6 Nov 2018 05:16:05 -0500 Subject: media: imx-pxp: Improve pxp_soft_reset() error message Improve 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 Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/imx-pxp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/media/platform/imx-pxp.c') diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index 986764de5616..b80d206f2b81 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -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); -- cgit v1.2.3 From dee0808d77ae857c74ee5b9a86e44fb366c33441 Mon Sep 17 00:00:00 2001 From: YueHaibing Date: Sat, 6 Oct 2018 03:36:02 -0400 Subject: media: imx-pxp: remove duplicated include from imx-pxp.c Remove duplicated include. Signed-off-by: YueHaibing Acked-by: Philipp Zabel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/imx-pxp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/media/platform/imx-pxp.c') diff --git a/drivers/media/platform/imx-pxp.c b/drivers/media/platform/imx-pxp.c index b80d206f2b81..c1c255408d16 100644 --- a/drivers/media/platform/imx-pxp.c +++ b/drivers/media/platform/imx-pxp.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3