Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423557 > unrolled thread

[PATCH 0/3] media: fixes for Amstrad Delta camera

Started byJanusz Krzysztofik <jmkrzyszt@gmail.com>
First post2016-06-16 00:40 +0200
Last post2016-06-16 00:40 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] media: fixes for Amstrad Delta camera Janusz Krzysztofik <jmkrzyszt@gmail.com> - 2016-06-16 00:40 +0200
    [PATCH 1/3] staging: media: omap1: fix null pointer dereference in omap1_cam_probe() Janusz Krzysztofik <jmkrzyszt@gmail.com> - 2016-06-16 00:40 +0200
    [PATCH 2/3] staging: media: omap1: fix sensor probe not working anymore Janusz Krzysztofik <jmkrzyszt@gmail.com> - 2016-06-16 00:40 +0200

#1423557 — [PATCH 0/3] media: fixes for Amstrad Delta camera

FromJanusz Krzysztofik <jmkrzyszt@gmail.com>
Date2016-06-16 00:40 +0200
Subject[PATCH 0/3] media: fixes for Amstrad Delta camera
Message-ID<rKrDA-8vO-11@gated-at.bofh.it>
Janusz Krzysztofik (3):
  staging: media: omap1: fix null pointer dereference in
    omap1_cam_probe()
  staging: media: omap1: fix sensor probe not working anymore
  media: i2c/soc_camera: fix ov6650 sensor getting wrong clock

 drivers/media/i2c/soc_camera/ov6650.c      |  2 +-
 drivers/staging/media/omap1/omap1_camera.c | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.7.3

[toc] | [next] | [standalone]


#1423558 — [PATCH 1/3] staging: media: omap1: fix null pointer dereference in omap1_cam_probe()

FromJanusz Krzysztofik <jmkrzyszt@gmail.com>
Date2016-06-16 00:40 +0200
Subject[PATCH 1/3] staging: media: omap1: fix null pointer dereference in omap1_cam_probe()
Message-ID<rKrDA-8vO-13@gated-at.bofh.it>
In reply to#1423557
Commit 76e543382bd4 ("staging: media: omap1: Switch to
devm_ioremap_resource") moved assignment of struct resource *res =
platform_get_resource() several lines down. That resulted in the
following error:

[    3.793237] Unable to handle kernel NULL pointer dereference at virtual address 00000004
[    3.802198] pgd = c0004000
[    3.805202] [00000004] *pgd=00000000
[    3.809373] Internal error: Oops: c5 [#1] ARM
[    3.814070] CPU: 0 PID: 1 Comm: swapper Not tainted 4.6.0-rc1+ #70
[    3.820570] Hardware name: Amstrad E3 (Delta)
[    3.825232] task: c1819440 ti: c181e000 task.ti: c181e000
[    3.830973] PC is at omap1_cam_probe+0x48/0x2d4
[    3.835873] LR is at devres_add+0x20/0x28

Move the assignment back up where it was before - it is used to build
an argument for a subsequent devm_kzalloc(). Also, restore the check
for null value of res - it shouldn't hurt.

While being at it:
- follow the recently introduced convention of direct return
  instead of jump to return with err value assigned,
- drop no longer needed res member from the definition of struct
  omap1_cam_dev.

Created and tested on Amstrad Delta aginst Linux-4.7-rc3

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
---
 drivers/staging/media/omap1/omap1_camera.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/omap1/omap1_camera.c b/drivers/staging/media/omap1/omap1_camera.c
index 54b8dd2..dc35d30 100644
--- a/drivers/staging/media/omap1/omap1_camera.c
+++ b/drivers/staging/media/omap1/omap1_camera.c
@@ -158,7 +158,6 @@ struct omap1_cam_dev {
 	int				dma_ch;
 
 	struct omap1_cam_platform_data	*pdata;
-	struct resource			*res;
 	unsigned long			pflags;
 	unsigned long			camexclk;
 
@@ -1569,11 +1568,10 @@ static int omap1_cam_probe(struct platform_device *pdev)
 	unsigned int irq;
 	int err = 0;
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if ((int)irq <= 0) {
-		err = -ENODEV;
-		goto exit;
-	}
+	if (!res || (int)irq <= 0)
+		return -ENODEV;
 
 	clk = devm_clk_get(&pdev->dev, "armper_ck");
 	if (IS_ERR(clk))
@@ -1614,7 +1612,6 @@ static int omap1_cam_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&pcdev->capture);
 	spin_lock_init(&pcdev->lock);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(base))
 		return PTR_ERR(base);
@@ -1663,7 +1660,6 @@ static int omap1_cam_probe(struct platform_device *pdev)
 
 exit_free_dma:
 	omap_free_dma(pcdev->dma_ch);
-exit:
 	return err;
 }
 
-- 
2.7.3

[toc] | [prev] | [next] | [standalone]


#1423561 — [PATCH 2/3] staging: media: omap1: fix sensor probe not working anymore

FromJanusz Krzysztofik <jmkrzyszt@gmail.com>
Date2016-06-16 00:40 +0200
Subject[PATCH 2/3] staging: media: omap1: fix sensor probe not working anymore
Message-ID<rKrDA-8vO-27@gated-at.bofh.it>
In reply to#1423557
After clock_start() removal from from soc_camera_probe() (commit
9aea470b39 '[media] soc-camera: switch I2C subdevice drivers to use
v4l2-clk', introduced in v3.11), it occurred omap1_camera's sensor
can't be probed successfully without its clock being turned on in
advance. Fix that by surrounding soc_camera_host_register() invocation
with clock_start() / clock_stop().

Created and tested on Amstrad Delta against Linux-4.7-rc3 with
'staging: media: omap1: fix null pointer dereference in
omap1_cam_probe()' applied.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
---
 drivers/staging/media/omap1/omap1_camera.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/omap1/omap1_camera.c b/drivers/staging/media/omap1/omap1_camera.c
index dc35d30..9b6140a 100644
--- a/drivers/staging/media/omap1/omap1_camera.c
+++ b/drivers/staging/media/omap1/omap1_camera.c
@@ -1650,7 +1650,11 @@ static int omap1_cam_probe(struct platform_device *pdev)
 	pcdev->soc_host.v4l2_dev.dev	= &pdev->dev;
 	pcdev->soc_host.nr		= pdev->id;
 
-	err = soc_camera_host_register(&pcdev->soc_host);
+	err = omap1_cam_clock_start(&pcdev->soc_host);
+	if (!err) {
+		err = soc_camera_host_register(&pcdev->soc_host);
+		omap1_cam_clock_stop(&pcdev->soc_host);
+	}
 	if (err)
 		return err;
 
-- 
2.7.3

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web