Hello. On 09/22/2013 12:58 AM, Sergei Shtylyov wrote:
After commit 09fc7d22b024692b2fe8a943b246de1af307132b (usb: musb: fix incorrect usage of resource pointer), CPPI DMA driver on DaVinci DM6467 can't detect its dedicated IRQ and so the MUSB IRQ is erroneously used instead. This is because only 2 resources are passed to the MUSB driver from the DaVinci glue layer, so fix this by always copying 3 resources (it's safe since a placeholder for the 3rd resource is always there) and passing 'pdev->num_resources' instead of the size of musb_resources[] to platform_device_add_resources().
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # 3.11+
--- The patch is against the 'fixes' branch of Felipe Balbi's 'usb.git' repo.
Changes in version 2: - resolved reject.
Oops, I've resolved it incorrectly! What was I thinking...
drivers/usb/musb/davinci.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) Index: usb/drivers/usb/musb/davinci.c =================================================================== --- usb.orig/drivers/usb/musb/davinci.c +++ usb/drivers/usb/musb/davinci.c @@ -509,7 +509,7 @@ static u64 davinci_dmamask = DMA_BIT_MAS static int davinci_probe(struct platform_device *pdev) { - struct resource musb_resources[2]; + struct resource musb_resources[2]; struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev); struct platform_device *musb; struct davinci_glue *glue; @@ -567,8 +567,17 @@ static int davinci_probe(struct platform musb_resources[1].end = pdev->resource[1].end; musb_resources[1].flags = pdev->resource[1].flags; + /* + * For DM6467 3 resources are passed. A placeholder for the 3rd + * resource is always there, so it's safe to always copy it... + */ + musb_resources[2].name = pdev->resource[2].name; + musb_resources[2].start = pdev->resource[2].start; + musb_resources[2].end = pdev->resource[2].end; + musb_resources[2].flags = pdev->resource[2].flags; +
Hm, gcc could have warned me about out of bound array access here but it didn't. Ah, I used too old version of gcc, 4.7 does warn...
WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html