From patchwork Mon Jul 8 10:55:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 2824797 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A003C0AB2 for ; Mon, 8 Jul 2013 10:56:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BABE200ED for ; Mon, 8 Jul 2013 10:56:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B9CB200E7 for ; Mon, 8 Jul 2013 10:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751430Ab3GHKzp (ORCPT ); Mon, 8 Jul 2013 06:55:45 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:49991 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998Ab3GHKzo (ORCPT ); Mon, 8 Jul 2013 06:55:44 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r68AthlY005872; Mon, 8 Jul 2013 05:55:43 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r68Ath86025148; Mon, 8 Jul 2013 05:55:43 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Mon, 8 Jul 2013 05:55:43 -0500 Received: from a0393678ub.apr.dhcp.ti.com (a0393678ub.apr.dhcp.ti.com [172.24.145.11]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r68AteNd030120; Mon, 8 Jul 2013 05:55:41 -0500 From: Kishon Vijay Abraham I To: , CC: , , , Subject: [PATCH] musb: omap: Fix: pass all the resources to musb core Date: Mon, 8 Jul 2013 16:25:29 +0530 Message-ID: <1373280929-19052-1-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit 09fc7d (usb: musb: fix incorrect usage of resource pointer) assumes musb core will always have only 2 resources. But for OMAP platforms there can be 3 resources (2 irq resource and 1 iomem resource). Fixed it here. Signed-off-by: Kishon Vijay Abraham I --- drivers/usb/musb/omap2430.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 5b6113a..5bbef78 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -481,7 +481,7 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32); static int omap2430_probe(struct platform_device *pdev) { - struct resource musb_resources[2]; + struct resource musb_resources[3]; struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; struct omap_musb_board_data *data; struct platform_device *musb; @@ -489,6 +489,7 @@ static int omap2430_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct musb_hdrc_config *config; int ret = -ENOMEM; + int i = 0; glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); if (!glue) { @@ -571,15 +572,12 @@ static int omap2430_probe(struct platform_device *pdev) memset(musb_resources, 0x00, sizeof(*musb_resources) * ARRAY_SIZE(musb_resources)); - musb_resources[0].name = pdev->resource[0].name; - musb_resources[0].start = pdev->resource[0].start; - musb_resources[0].end = pdev->resource[0].end; - musb_resources[0].flags = pdev->resource[0].flags; - - musb_resources[1].name = pdev->resource[1].name; - musb_resources[1].start = pdev->resource[1].start; - musb_resources[1].end = pdev->resource[1].end; - musb_resources[1].flags = pdev->resource[1].flags; + for (i = 0; i < ARRAY_SIZE(musb_resources); i++) { + musb_resources[i].name = pdev->resource[i].name; + musb_resources[i].start = pdev->resource[i].start; + musb_resources[i].end = pdev->resource[i].end; + musb_resources[i].flags = pdev->resource[i].flags; + } ret = platform_device_add_resources(musb, musb_resources, ARRAY_SIZE(musb_resources));