Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2014668imu; Fri, 14 Dec 2018 04:32:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/VSqNm6hSSltjODWzffCSmj2hSYP5W0z+Lv6FBIKsq6wNTxiXVwEIFWicCsdPiNndwl6gWa X-Received: by 2002:a63:4f20:: with SMTP id d32mr2547562pgb.47.1544790720383; Fri, 14 Dec 2018 04:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544790720; cv=none; d=google.com; s=arc-20160816; b=tAUjr07W2mQ9/NCmpLLOMHKh12oW7RFFcdD/mERCpaR99IGde3WsAaV+THEQh2DWEd 4ADROm2lY8I7mqmETXw2qOqEdkkwfCwYeRtWM5ql63glYOo28XxfSqTwFd3sisP5c6G+ FQ9ax41XdKmf3eCcPXUreKA6swNOHdKv2fsp3xfzwbWmgz4XtQ9KLrH1GGzqDXy6zRgd G6ot8rhtI752NnlI7pv6XZhTnXAfLnlzDf+6ftCrkMeUwfiXbq2GRECbo058BkonVjcy YzIRpJvl33htbdX2yNSCjT3Pb1GFGPW24THZ9B2XXk/rna1DVl0Ef8g6GVMSBRap8zK2 C4Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O6vhqgiwnF4yZuJ903SzUZ21m6QrSCbEFdtNFPkf2UA=; b=hCutewjT9czuxCa+wC2euj4XXE9B3e35agt+eUgshy0ZcoHzGZNEABDDPA8G052dws xfHoJUSsIrrJnKEs1z4SaS9XVRfiEyXIOVbbP+tM9sqFTrWX/q+/DmRaIPr3jvoyTxX/ 8t4fh695vpePH5pFet1cCE3qGUyTCWeH1hZZPX42L2M/6Uj+siYu/VPVLhODjvQl84RE aSjx37kBSpEeOAQ41gcjvU2brd1hZAXfrYy0XqvOApJ07hxD45r3Lv0mitikeYOSRdcS TBBKA/0mxxPpY43y7oS0mY/DD0vnlSKNKj2Nn1Mvgf6lKpEn4sIRmVpj3+E7UXizSzjA adwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MO9ElEt1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si3770382plr.211.2018.12.14.04.31.45; Fri, 14 Dec 2018 04:32:00 -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; dkim=pass header.i=@kernel.org header.s=default header.b=MO9ElEt1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731226AbeLNMKL (ORCPT + 99 others); Fri, 14 Dec 2018 07:10:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:55884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731566AbeLNMKG (ORCPT ); Fri, 14 Dec 2018 07:10:06 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25B2A214C4; Fri, 14 Dec 2018 12:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789405; bh=jC4Nu1xBPXXw52oarbN7n7OAWDt+1TedKP7UR8cUJuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MO9ElEt1EkhYJKz1xuT1Swh8aiJuA8927IQJYp6zw9fxbCUc6IWcfEIFAf504xzCk rSEpdha43BARnBm6KmVkTFNm4DJ6tWuBvOY98tggvSw1grE/0IbK7rVq6oXsxKF0o6 I7ua/2Ud3O/3iZKzrb4fr3jQoerUONDpFYYgCLMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , Felipe Balbi , Sasha Levin Subject: [PATCH 4.14 47/89] USB: omap_udc: use devm_request_irq() Date: Fri, 14 Dec 2018 13:00:00 +0100 Message-Id: <20181214115731.992903715@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115729.658859279@linuxfoundation.org> References: <20181214115729.658859279@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 286afdde1640d8ea8916a0f05e811441fbbf4b9d ] 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 Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- 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 f05ba6825bfe..e515c85ef0c5 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2886,8 +2886,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); @@ -2895,20 +2895,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()) { @@ -2921,22 +2921,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; @@ -2980,12 +2969,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.19.1