Re: [PATCH v2 1/8] ohci-nxp: Driver cleanup

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


On 17/04/12 22:36, Arnd Bergmann wrote:
>> +       hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
>> +       if (!hcd->regs) {
>> +               err("Failed to devm_request_and_ioremap");
>>                 ret =  -ENOMEM;
>>                 goto out4;
>>         }
>> -       hcd->regs = (void __iomem *)pdev->resource[0].start;
>> +       hcd->rsrc_start = (u64)(u32)hcd->regs;
>> +       hcd->rsrc_len = resource_size(res);
> This is wrong in multiple ways:
> * rsrc_start is a physical address, not an __iomem token.
> * you cannot cast a pointer to u32 in general, only to unsigned long.
> The fact that you need an ugly type cast like above could have told
> you that you are doing something wrong here. I guess it should
> be
> 	hcd->rsrc_start = res->start;

Right. Thanks for the hint!

Technically, I ported the bug, didn't introduce it ;-)
(pdev->resource[0].start was previously provided via resource already in
IO_ADDRESS (mapped) format). Nevertheless, it's a bug, of course, and it
didn't show up since the driver seems to not use hcd->rsrc_start anyway
(but hcd->regs).

Will post an update after making sure it's tested well.


linux-arm-kernel mailing list

[Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [PDAs]     [Linux]     [Linux MIPS]     [Yosemite Campsites]     [Photos]

Add to Google Follow linuxarm on Twitter