diff mbox

[v3,2/4] media: adv7180: add adv7180cp, adv7180st compatible strings

Message ID 1495199224-16337-3-git-send-email-ulrich.hecht+renesas@gmail.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Ulrich Hecht May 19, 2017, 1:07 p.m. UTC
Used to differentiate between models with 3 and 6 inputs.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
 drivers/media/i2c/adv7180.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Geert Uytterhoeven June 30, 2017, 9:19 a.m. UTC | #1
Hi Ulrich,

On Fri, May 19, 2017 at 3:07 PM, Ulrich Hecht
<ulrich.hecht+renesas@gmail.com> wrote:
> Used to differentiate between models with 3 and 6 inputs.
>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
>  drivers/media/i2c/adv7180.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index bdbbf8c..78de7dd 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -1452,6 +1452,8 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
>  #ifdef CONFIG_OF
>  static const struct of_device_id adv7180_of_id[] = {
>         { .compatible = "adi,adv7180", },
> +       { .compatible = "adi,adv7180cp", },
> +       { .compatible = "adi,adv7180st", },
>         { .compatible = "adi,adv7182", },
>         { .compatible = "adi,adv7280", },
>         { .compatible = "adi,adv7280-m", },

Adding compatible entries here is not sufficient, and causes a crash on
r8a7793/gose with renesas-drivers-2017-06-27-v4.12-rc7:

    adv7180 2-0020: chip found @ 0x20 (e6530000.i2c)
    Unable to handle kernel NULL pointer dereference at virtual address 00000014
    pgd = c0003000
    [00000014] *pgd=80000040004003, *pmd=00000000
    Internal error: Oops: 207 [#1] SMP ARM
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc7-rcar2-initrd #37
    Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
    task: df427040 task.stack: df436000
    PC is at adv7180_probe+0x84/0x3cc

In the absence of an entry in adv7180_id[], the passed i2c_device_id
pointer is NULL, and thus dereferencing it crashes the system.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Ulrich Hecht July 3, 2017, 8:44 a.m. UTC | #2
On Fri, Jun 30, 2017 at 11:19 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Ulrich,
>
> On Fri, May 19, 2017 at 3:07 PM, Ulrich Hecht
> <ulrich.hecht+renesas@gmail.com> wrote:
>> Used to differentiate between models with 3 and 6 inputs.
>>
>> Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
>> ---
>>  drivers/media/i2c/adv7180.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
>> index bdbbf8c..78de7dd 100644
>> --- a/drivers/media/i2c/adv7180.c
>> +++ b/drivers/media/i2c/adv7180.c
>> @@ -1452,6 +1452,8 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
>>  #ifdef CONFIG_OF
>>  static const struct of_device_id adv7180_of_id[] = {
>>         { .compatible = "adi,adv7180", },
>> +       { .compatible = "adi,adv7180cp", },
>> +       { .compatible = "adi,adv7180st", },
>>         { .compatible = "adi,adv7182", },
>>         { .compatible = "adi,adv7280", },
>>         { .compatible = "adi,adv7280-m", },
>
> Adding compatible entries here is not sufficient, and causes a crash on
> r8a7793/gose with renesas-drivers-2017-06-27-v4.12-rc7:
>
>     adv7180 2-0020: chip found @ 0x20 (e6530000.i2c)
>     Unable to handle kernel NULL pointer dereference at virtual address 00000014
>     pgd = c0003000
>     [00000014] *pgd=80000040004003, *pmd=00000000
>     Internal error: Oops: 207 [#1] SMP ARM
>     Modules linked in:
>     CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc7-rcar2-initrd #37
>     Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
>     task: df427040 task.stack: df436000
>     PC is at adv7180_probe+0x84/0x3cc
>
> In the absence of an entry in adv7180_id[], the passed i2c_device_id
> pointer is NULL, and thus dereferencing it crashes the system.

Thank you for testing this. I have sent a fix (" media: adv7180: add
missing adv7180cp, adv7180st i2c device IDs"), could you please check
if it unbreaks things for you?

CU
Uli
diff mbox

Patch

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index bdbbf8c..78de7dd 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1452,6 +1452,8 @@  static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
 #ifdef CONFIG_OF
 static const struct of_device_id adv7180_of_id[] = {
 	{ .compatible = "adi,adv7180", },
+	{ .compatible = "adi,adv7180cp", },
+	{ .compatible = "adi,adv7180st", },
 	{ .compatible = "adi,adv7182", },
 	{ .compatible = "adi,adv7280", },
 	{ .compatible = "adi,adv7280-m", },