Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp66462pxb; Mon, 13 Sep 2021 13:06:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu6X2AEjeGklvspy4mCYCIsMMk+jzMdJYtkFs4RRJh8qq5skulX22+MhWGDC51wiMt51TJ X-Received: by 2002:a17:907:2a85:: with SMTP id fl5mr14213765ejc.91.1631563590048; Mon, 13 Sep 2021 13:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631563590; cv=none; d=google.com; s=arc-20160816; b=yqxkQ5IqnBbMjlj/iLVENiooH9bQw47Ql6W7YXRNYHLJq+28qaAe5hLbA/NqYerdSA TVMLQqe4PoMuaEnD3Ro++DbpCzpDxYZXg9xfPl0NO3vS6rzMMf3YDtVMmaJrpySpYW/p 2TPi6I9WrHrdaIC3QGxIdn+Ly/qYruoCRCgESg/6Z3RX32guCsoX09euUK5sNUAxrlHs 0BtkarvkWt9NuejQc+M+aunHzSCiO1PLrQ6Sk+K2fuVj+vs+Rot7COla75VxUTz64bNj wezlv13fyU6dCdrfn3lbdRLRZrieLwgg85z45l6DRZ9YjFmfktN9azd7Eh3x3peguUub kXqQ== 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=0yNjFjT5tt4dTQNZ9dVw0e/ESbmZOqFM9dr1IzB0uTM=; b=PhPTaiboYBOwIBHUm+R7MhihHuzjxwF59+MZ/EqA0UlzJviHhcBJmE0ban36dVkYF6 R0zwX6JX/84l9qCdv6XjhpaBs6uL7iBkPwKxQclwXnCgubEjz5l58ETpDlncgeMtOjs/ UWaHLFqivvDdNGz0xPAFJl/dYaEQYJa3NG45sgliHi6hwXu4HgGnXYZs+yUAb/vr8YR1 buVxrE2JkQPwAePyb+8zfPdJF53J9/9C5zIToASHUQRuYbUeEvHjPRBJPJ5xVDjnm9O8 u+x2fSNakw+t+Xb7fqFI66e2fzBNMo4eaj40wcX6AAknCtOvNReBcOF6bs/xPGlKjDox aInw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RleUOcpy; 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 z12si8072025edp.308.2021.09.13.13.06.06; Mon, 13 Sep 2021 13:06:30 -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=RleUOcpy; 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 S243935AbhIMNpD (ORCPT + 99 others); Mon, 13 Sep 2021 09:45:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:37748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243816AbhIMNkF (ORCPT ); Mon, 13 Sep 2021 09:40:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1ED2B613D5; Mon, 13 Sep 2021 13:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539756; bh=V1GOIwFe2wEm60a3E7+/DpJsh1gioHZlFyiudEwq0OM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RleUOcpyq8+oP6C3yRT+XppqBpzdyBfbyggdqhU7MMXjbqI4M7ij2gCL1lHCxq3mb RLqXJs8IJAk9ZpEZFlA2J3RAQaGpRtZBtPcp7A1sCdkeXMbJVFkNcLSbkHm2v7p0CD OV2BJVckLXrGUG+1nI9eY4msK0DvW8Pb7ZpYCmDE= 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.10 149/236] usb: gadget: udc: at91: add IRQ check Date: Mon, 13 Sep 2021 15:14:14 +0200 Message-Id: <20210913131105.435982262@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 eede5cedacb4..d9ad9adf7348 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -1876,7 +1876,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