Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319466pxb; Mon, 20 Sep 2021 18:42:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4wGSpwT2LyT+EMKMLq/HVkM94yTgtJBsp+nfcBEXPXk5OgTLMttgcsiSNB15QAFK5jdcp X-Received: by 2002:a05:6e02:921:: with SMTP id o1mr18361179ilt.289.1632188556453; Mon, 20 Sep 2021 18:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188556; cv=none; d=google.com; s=arc-20160816; b=uCqO81Z8EcnW234SRFWxtN1ypQ28wCLUF9SCk2w4IsK9uk1ixz40gNmzuLD3UsC/8a DO1/CuDnyZq35KvQsKWKHFDgHdXgwlWSaBgHxdreJo83/27PgOFsZFEJ4doOa3gl1eSF WjtiIuqoHSljqPyEDPKC/yLvvrsovJvIJcFW8bEpPWCRu8M78VaelF8BNSRSFQ3/Rac2 dUQDfCRXz/mmdMJkoKbJOYR154kEG+1LGTP3Lcox4oHveaN7ZU85yqOSTbZ0ZY6nbcR5 IbnJpLQ05sbjusFM1WclrXqr67BGFCL+b/LWEBZK5ohW8WKMLMF8sZ7N/SiJSX5X4Q+2 wTJA== 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=vM0jW8jf4ZiCn44QXJXnzwjUmekg1VrgPVC1ScP3g84=; b=IoRa8NE5KvK9czzh4VktsR6V7n6h6LvJgrAVSKPAo/xMh6ncmZISr3kL5+IObyqTSt Vn2ocU5LzyER8wnWKy9Lv2EQkpe63riZ1dkz9MUtXQUZtUyHlBEFCav9bLHorZ51Jcc3 iTVYlgzVT0drauaRvKAdOLKuFDoDfCfFql32wIe3YCAx7iGpe782Tc9lAjj0P8VnbIOX OSoUgsk5kJOU1jA1z963u6JWDmF7RvVtG65UkWj6YXq3bjmnDjba/h1ioP/IBDPLpHQV kmbGx8dQ9zMRqLNTJ7FZtywNcoLzeyhtsBayLAshE0oz6tR6Z1qPG08VB6TX2fJdl2HK Ov/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JzuHLIDU; 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 n5si11795809iob.93.2021.09.20.18.42.25; Mon, 20 Sep 2021 18:42:36 -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=JzuHLIDU; 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 S243604AbhITQvZ (ORCPT + 99 others); Mon, 20 Sep 2021 12:51:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:36076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243822AbhITQs2 (ORCPT ); Mon, 20 Sep 2021 12:48:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4529360F38; Mon, 20 Sep 2021 16:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156421; bh=j3v+nF3tpDtVa4rpgCAa12rLRKgxpmnIELL/u8Dt1iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JzuHLIDUE9r7SR0oKZ24h/DHYhZRQKIpTcKbtYbqwA986ldhCbJfacD69YzdeINuR AdTLO4MIR7UL1NAWdYsngd5NOEJqQH0kewJpDJ/CmkEC6uIqlrKU+OTI6QkrCa7jqT 2jYCYbIIJFAsfizT/jliYhijOGV5GEE1hvbwX8fE= 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 4.4 050/133] usb: gadget: udc: at91: add IRQ check Date: Mon, 20 Sep 2021 18:42:08 +0200 Message-Id: <20210920163914.280229968@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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 d0d18947f58b..2da281a743b8 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -1898,7 +1898,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