Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1935083imu; Sun, 18 Nov 2018 12:00:37 -0800 (PST) X-Google-Smtp-Source: AJdET5dnBwuDSCK5RwKgBESqA5P0cMpIMUlMIP87MLWgsCzXOQEUYOTklUFt9pDgqG3eSL4/drbZ X-Received: by 2002:a65:4683:: with SMTP id h3mr16802562pgr.225.1542571237933; Sun, 18 Nov 2018 12:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542571237; cv=none; d=google.com; s=arc-20160816; b=KAyz54gNThhUvFpEm/c/x9Vb5YyCClWvgBvWTZbtxWKJRWeQzaUdXLcLt8uf4DiWew mpLF5GGkaDHWf8vg9aZHwkMYHnOZBn/Fc96ht54hzrryZvxKB7hGa25hxlKbBSIQarBE OZx2p7cqLktZG8c5xgIN6TXA7TlL5X/6jwU8Fg8oIENxpSOYegAARoLmN1tS7cy/HBVe QjT2en5BIchEDB685tBx3Df9TVCt+w/oApi6MMpQyqzJCapDFQCipYd3Fzi4sRgH55WR Ool80F19Xnov5FOwhtHwPM74ptPaogyy/aabbW6zpx7W/eyM765dBcYuRrvzRNpLuPz6 CXDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=JhrY3pbYO2YW860jKO8aVoIlrCNyPrnEtra5ZlbKwYg=; b=m8XNQWwf+EuGm/LWGOiHvrUhljJ8jTNdsBxutGgOsZB5OFRlC40T7B9xiFvaJn+qwq TQ1o5DcN3cVEztskqy/mSQylOwrBdbBzPo6+RP+XwL0bv02PpGKcq1HZwKUx1SHMvnPj pcAnqqh7NiZPotxEQM1w3E14ptu0HGU+vkXsE9DtEDeaySgBhoml8RZnDZVpQ9dbe67G PLWHIejujMeKHDjj5o2bE5UFNie5cyZY0p1BK3hC+l+5dFfZlNm1fEsaFSBiYDsp0VM8 XWcajIbbhzPr4PwFgwm/1D6yHIPHA0JAhULID3HCCz0hF7ANAy9s89SP7ZSkW2Z21xtI GrcA== 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 bj11si17965070plb.21.2018.11.18.12.00.23; Sun, 18 Nov 2018 12:00:37 -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 S1727333AbeKSGUv (ORCPT + 99 others); Mon, 19 Nov 2018 01:20:51 -0500 Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:45758 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbeKSGUu (ORCPT ); Mon, 19 Nov 2018 01:20:50 -0500 Received: from localhost.localdomain (85-76-71-135-nat.elisa-mobile.fi [85.76.71.135]) by emh01.mail.saunalahti.fi (Postfix) with ESMTP id 592C52002F; Sun, 18 Nov 2018 21:59:36 +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 1/4] USB: omap_udc: use devm_request_irq() Date: Sun, 18 Nov 2018 21:59:09 +0200 Message-Id: <20181118195912.14026-1-aaro.koskinen@iki.fi> X-Mailer: git-send-email 2.17.0 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