Re: pxa_camera: Oops in pxa_camera_probe.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 1 Jul 2009 20:43:25 +0200
Antonio Ospite <ospite@xxxxxxxxxxxxxxxxx> wrote:

> Hi,
> 
> I get this with pxa-camera in mainline linux (from today).
> I haven't touched my board code which used to work in 2.6.30
>

I think I've tracked down the cause. The board code is triggering a
bug in pxa_camera. The same should apply to mioa701 as well.

> Linux video capture interface: v2.00
> Unable to handle kernel NULL pointer dereference at virtual address 00000060
> pgd = c0004000
> [00000060] *pgd=00000000
> Internal error: Oops: f5 [#1] PREEMPT
> Modules linked in:
> CPU: 0    Tainted: G        W   (2.6.31-rc1-ezxdev #1)
> PC is at dev_driver_string+0x0/0x38
> LR is at pxa_camera_probe+0x144/0x428

The offending dev_driver_str() here is the one in the dev_warn() call in
mclk_get_divisor().

This is what is happening: in struct pxacamera_platform_data I have:
	.mclk_10khz = 5000,

which makes the > test in mclk_get_divisor() succeed calling dev_warn
to report that the clock has been limited, but pcdev->soc_host.dev is
still uninitialized at this time.

I could lower the value in my platform data and avoid the bug, but it
would be good to have this fixed ASAP anyway.

The attached rough patch fixes the problem, but you will surely come
out with a better one :)

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
mclk_get_divisor uses pcdev->soc_host.dev, make sure it is initialized.

Signed-off-by: Antonio Ospite <ospite@xxxxxxxxxxxxxxxxx>

diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index 46e0d8a..e048d25 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -1579,6 +1579,7 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev)
 		pcdev->mclk = 20000000;
 	}
 
+	pcdev->soc_host.dev = &pdev->dev;
 	pcdev->mclk_divisor = mclk_get_divisor(pcdev);
 
 	INIT_LIST_HEAD(&pcdev->capture);
@@ -1644,7 +1645,6 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev)
 	pcdev->soc_host.drv_name	= PXA_CAM_DRV_NAME;
 	pcdev->soc_host.ops		= &pxa_soc_camera_host_ops;
 	pcdev->soc_host.priv		= pcdev;
-	pcdev->soc_host.dev		= &pdev->dev;
 	pcdev->soc_host.nr		= pdev->id;
 
 	err = soc_camera_host_register(&pcdev->soc_host);

Attachment: pgpUP2fP6tR64.pgp
Description: PGP signature


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux