Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3933264imu; Sat, 24 Nov 2018 14:18:35 -0800 (PST) X-Google-Smtp-Source: AJdET5eBsmOAbQ/JA8WUFuwUY0Jfco4GWcrLTkj/oFXRSxBG44XZXTaE+c1MC8J/D4eUAWXCX7Xm X-Received: by 2002:a62:682:: with SMTP id 124-v6mr21663783pfg.161.1543097915733; Sat, 24 Nov 2018 14:18:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543097915; cv=none; d=google.com; s=arc-20160816; b=vLcUyTfcptlr4k40NnTIudFu9msZaIPXYOQQxiIzDhTUT9picj1wL1eIsJcP6ZLUs5 IiDsQ1jwHf/GTl/3ClrxeQ7nBtrshPEf5qrLReqeJer5Jlt/7Wi5s1hxFkKlw4hb1LrD F0dtlTDVAcGSuO3YD5WFaQa+9DOPDy+Hz+3mLtoD+hPSkBQfEDMBBKngLd+Lh3ha/JX3 pZEN9KORyjuuElYSPktF7mqGDkEW7BChkZPx/e0dgpPHRCOj7tOdqYWM4bfsG6r9Xtqh RjhtgqgYc4CiYBx7rf/ohgtYHvDRSAdh0PrkX36iAX4OyA9EAQQGsPCB/ybE+jZGWTFd IjCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=JhrY3pbYO2YW860jKO8aVoIlrCNyPrnEtra5ZlbKwYg=; b=msooiWj3z+y0bmwJJLY9Hr2YHl0toglQOAFoSCSWtrhJ6/KoEZXUt1WdrXLE0aewLd 20MHM13TeG3GILpLEMRb1o8oCVDQd2e20llMMSjdCRlD/cOL1Jm/SavaHDlGXcVfTiLr Ju2yoeyMCZFee1IMnn8UZJlKt37IAc7zAPyF16NHIVf+3l5NbqN/vpwHF520oOka5da2 MNnk8nRbTegvtqVytjE+cJZZGMr6kaNOfX3XCJBTwDaY9kxlU6D1VxTFL2RKFATIv9l8 wp9nSneOYjDIcB5wcbyADpmzO/Xvccjr0owccntGTCWlZL93mIWaUR8G1idLsIhtsOeQ Ngyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z38si45519607pga.193.2018.11.24.14.18.20; Sat, 24 Nov 2018 14:18:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbeKYJGn (ORCPT + 99 others); Sun, 25 Nov 2018 04:06:43 -0500 Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:43954 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbeKYJGm (ORCPT ); Sun, 25 Nov 2018 04:06:42 -0500 Received: from localhost.localdomain (85-76-84-147-nat.elisa-mobile.fi [85.76.84.147]) by emh01.mail.saunalahti.fi (Postfix) with ESMTP id D93C6200CC; Sun, 25 Nov 2018 00:17:13 +0200 (EET) From: Aaro Koskinen To: Felipe Balbi , linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Tony Lindgren , Aaro Koskinen Subject: [PATCH v2 1/5] USB: omap_udc: use devm_request_irq() Date: Sun, 25 Nov 2018 00:17:04 +0200 Message-Id: <20181124221708.31003-2-aaro.koskinen@iki.fi> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20181124221708.31003-1-aaro.koskinen@iki.fi> References: <20181124221708.31003-1-aaro.koskinen@iki.fi> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current code fails to release the third irq on the error path (observed by reading the code), and we get also multiple WARNs with failing gadget drivers due to duplicate IRQ releases. Fix by using devm_request_irq(). Signed-off-by: Aaro Koskinen --- drivers/usb/gadget/udc/omap_udc.c | 37 +++++++++---------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 3a16431da321..1c77218c82af 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2867,8 +2867,8 @@ static int omap_udc_probe(struct platform_device *pdev) udc->clr_halt = UDC_RESET_EP; /* USB general purpose IRQ: ep0, state changes, dma, etc */ - status = request_irq(pdev->resource[1].start, omap_udc_irq, - 0, driver_name, udc); + status = devm_request_irq(&pdev->dev, pdev->resource[1].start, + omap_udc_irq, 0, driver_name, udc); if (status != 0) { ERR("can't get irq %d, err %d\n", (int) pdev->resource[1].start, status); @@ -2876,20 +2876,20 @@ static int omap_udc_probe(struct platform_device *pdev) } /* USB "non-iso" IRQ (PIO for all but ep0) */ - status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, - 0, "omap_udc pio", udc); + status = devm_request_irq(&pdev->dev, pdev->resource[2].start, + omap_udc_pio_irq, 0, "omap_udc pio", udc); if (status != 0) { ERR("can't get irq %d, err %d\n", (int) pdev->resource[2].start, status); - goto cleanup2; + goto cleanup1; } #ifdef USE_ISO - status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, - 0, "omap_udc iso", udc); + status = devm_request_irq(&pdev->dev, pdev->resource[3].start, + omap_udc_iso_irq, 0, "omap_udc iso", udc); if (status != 0) { ERR("can't get irq %d, err %d\n", (int) pdev->resource[3].start, status); - goto cleanup3; + goto cleanup1; } #endif if (cpu_is_omap16xx() || cpu_is_omap7xx()) { @@ -2902,22 +2902,11 @@ static int omap_udc_probe(struct platform_device *pdev) create_proc_file(); status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget, omap_udc_release); - if (status) - goto cleanup4; - - return 0; + if (!status) + return 0; -cleanup4: remove_proc_file(); -#ifdef USE_ISO -cleanup3: - free_irq(pdev->resource[2].start, udc); -#endif - -cleanup2: - free_irq(pdev->resource[1].start, udc); - cleanup1: kfree(udc); udc = NULL; @@ -2961,12 +2950,6 @@ static int omap_udc_remove(struct platform_device *pdev) remove_proc_file(); -#ifdef USE_ISO - free_irq(pdev->resource[3].start, udc); -#endif - free_irq(pdev->resource[2].start, udc); - free_irq(pdev->resource[1].start, udc); - if (udc->dc_clk) { if (udc->clk_requested) omap_udc_enable_clock(0); -- 2.17.0