kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: pxa_camera: remove an impossible condition
@ 2020-06-10 17:26 Dan Carpenter
  2020-06-15 10:35 ` Robert Jarzmik
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-06-10 17:26 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Robert Jarzmik
  Cc: Hans Verkuil, Chuhong Yuan, Peter Ujfalusi, linux-media, kernel-janitors

It's not possible for "pcdev->mclk" to be zero because we check for
that earlier and set it to 20000000 in that situation.  If it were
possible, that would be a problem because it could have lead to an Oops
in the error handling when we call v4l2_clk_unregister(pcdev->mclk_clk);

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/media/platform/pxa_camera.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
index 3c5fe737d36f7..8e5613c1fe067 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -2504,17 +2504,14 @@ static int pxa_camera_probe(struct platform_device *pdev)
 	if (err)
 		goto exit_notifier_cleanup;
 
-	if (pcdev->mclk) {
-		v4l2_clk_name_i2c(clk_name, sizeof(clk_name),
-				  pcdev->asd.match.i2c.adapter_id,
-				  pcdev->asd.match.i2c.address);
-
-		pcdev->mclk_clk = v4l2_clk_register(&pxa_camera_mclk_ops,
-						    clk_name, NULL);
-		if (IS_ERR(pcdev->mclk_clk)) {
-			err = PTR_ERR(pcdev->mclk_clk);
-			goto exit_notifier_cleanup;
-		}
+	v4l2_clk_name_i2c(clk_name, sizeof(clk_name),
+			  pcdev->asd.match.i2c.adapter_id,
+			  pcdev->asd.match.i2c.address);
+
+	pcdev->mclk_clk = v4l2_clk_register(&pxa_camera_mclk_ops, clk_name, NULL);
+	if (IS_ERR(pcdev->mclk_clk)) {
+		err = PTR_ERR(pcdev->mclk_clk);
+		goto exit_notifier_cleanup;
 	}
 
 	err = v4l2_async_notifier_register(&pcdev->v4l2_dev, &pcdev->notifier);
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: pxa_camera: remove an impossible condition
  2020-06-10 17:26 [PATCH] media: pxa_camera: remove an impossible condition Dan Carpenter
@ 2020-06-15 10:35 ` Robert Jarzmik
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Jarzmik @ 2020-06-15 10:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Chuhong Yuan,
	Peter Ujfalusi, linux-media, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> writes:

> It's not possible for "pcdev->mclk" to be zero because we check for
> that earlier and set it to 20000000 in that situation.  If it were
> possible, that would be a problem because it could have lead to an Oops
> in the error handling when we call v4l2_clk_unregister(pcdev->mclk_clk);
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

Cheers.

--
Robert

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-15 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 17:26 [PATCH] media: pxa_camera: remove an impossible condition Dan Carpenter
2020-06-15 10:35 ` Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).