Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1825073pxb; Mon, 13 Sep 2021 06:24:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynBpc7saITJv0buCGtK80jzwKW7hW1ITPOhPhQNAd/KGpVtBRHFoxArTPAnMXi+/Qc+qu0 X-Received: by 2002:a6b:fd05:: with SMTP id c5mr9032753ioi.102.1631539450588; Mon, 13 Sep 2021 06:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631539450; cv=none; d=google.com; s=arc-20160816; b=sm/u1pKXIE/QDYsBwASYcxubWbb4IJ0h6gVBcL3UdCSYLxhfDNwvdSe6JrrmvOq60X yWPwTU7EX3sxtGprxz/J6WXZq9M+iNMunF03J9wgcfwywMZH5JQ89kaBisw1Puo6bx7c oToj52cLJDu+tEYA5buLnxHN6Gti5kbXpZmOdyJ/OwG5iAKKx7abQisaXN1MADhUdsWw sGpgJnGjsuh8+IFlBYA0kiBfJQyZAuulWr7yRtdtWaIodojhTY6kzUY05h/pU1uSOlgM 8ILwZpIhYxmFJQ1TS9Jf7HyuuLuGS3UKp4hnPoGzLsZ4+s0mwB6V3S7fdf0XZTHqDb0F yh7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5TGI1LgenZ02MewnsmxmJVpb6wdDJzmGrNE1Rjq0+Lg=; b=eSrV7M2Yppm0EHQQX8H1V7nwC54H7kV4VFKxqiRhGmL8d+OX3W4QkK+I3+Zqa/JQy2 icxNBw7KYummd1oxYTyv3iWBJw0I/HFVnrfYgjQnFuSmRgDp0n8YAyOEovH4KcIiQMlc 1z8Mn1PSMGAKrwamzGXbv/BisFUNtPRkK3z/Tsx/6P/9y7aot7IPppk4W1jl/EWwQxK/ 2s0OixxUtZnLDUeg1cdOo77OO/Xwuq36TlqiEtUVhkFapd99hmZ0rcKSYwwJ94PYSliV EFWVKA/Tg0R0rcsnpKJvsUDQcQ3vNxdRj6TQ8GGR//upVcVRsmLoo/0eAAtlIcVS+A1h O8rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NDsQUSdT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e18si6601320jaf.117.2021.09.13.06.23.58; Mon, 13 Sep 2021 06:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NDsQUSdT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241347AbhIMNXz (ORCPT + 99 others); Mon, 13 Sep 2021 09:23:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:37956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240849AbhIMNVo (ORCPT ); Mon, 13 Sep 2021 09:21:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D33760724; Mon, 13 Sep 2021 13:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539227; bh=Q0W0lOliWfOwnsx89uXnlM//gTZlv78e+UFLvXdxUWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDsQUSdTz5raCJ8YaayAOmpfd7utIGA8OGWyvFJJ7zMR8dgLe+Itbb2IOFDEgYAci WPLHlH+KwEIwqBd8FxJc+v6due64PmpPAavizXnzXB9q0hY4J51axMJseIMjjFLq7Z GDWMseYjWGqP4Ql+569WtpM4Kk+YNuSi2JxMtXZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Felipe Balbi , Sasha Levin Subject: [PATCH 5.4 088/144] usb: gadget: udc: at91: add IRQ check Date: Mon, 13 Sep 2021 15:14:29 +0200 Message-Id: <20210913131050.896025216@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit 50855c31573b02963f0aa2aacfd4ea41c31ae0e0 ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with the invalid IRQ #s. Fixes: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management") Signed-off-by: Sergey Shtylyov Acked-by: Felipe Balbi Link: https://lore.kernel.org/r/6654a224-739a-1a80-12f0-76d920f87b6c@omp.ru Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/udc/at91_udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 194ffb1ed462..d7714c94b119 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -1878,7 +1878,9 @@ static int at91udc_probe(struct platform_device *pdev) clk_disable(udc->iclk); /* request UDC and maybe VBUS irqs */ - udc->udp_irq = platform_get_irq(pdev, 0); + udc->udp_irq = retval = platform_get_irq(pdev, 0); + if (retval < 0) + goto err_unprepare_iclk; retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0, driver_name, udc); if (retval) { -- 2.30.2