Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3589436pxb; Mon, 24 Jan 2022 12:58:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmWQVasSYHNzZUmsIMyubHdGinou83M1q99rrM+ZcWo8k2uALFEIAKgPMHuLPjyB5Ko3p8 X-Received: by 2002:a17:90b:4c91:: with SMTP id my17mr138048pjb.121.1643057905509; Mon, 24 Jan 2022 12:58:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057905; cv=none; d=google.com; s=arc-20160816; b=X7bCH0I2eVwfWn9Clwdrn9V6q9S1q/kFtTmAPjVyZzyQvgsW6wZbXmrgVTxAGbENha 4bJrvJCioYayH+im0ZhAn7jPOIIDON57nkqfiBX+u3Nv+5BdiPl/vMsWwDbZ1MWmwUAL NeGGAi/dDtdaXiNhLq2k4a3WCqp51ecb5PbB4B3W1c0azAXsRrZY6O/ZcWWvCJRDIBo3 XZ8mYifr7INdeCmeROjIXtKZycO0Nka7QNrpum2cwi6PM/DPI0cmaQM820M13OEqP6Rs 4Rft7lnj0pfCNOuTzZ7CH+Us5nNEqHHrc0fqYWtp3Xg2ttMPVD0F3oD1oEC/lTuIu8ST vO+w== 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=nJ95EGkcDosesAcyQqbCZ3l2a0ViBEHJVcGySGnKQrA=; b=r+K2NE8Nk9alnYnvIz3uZDN3yjcYavfXYyUejVsViLZDiZ1Kf2j0jHbR5kWwIeflam tnibQmiyc9RBy5mZS3mZqX4sGgpc9tfORvsDaC39wDq77PPa5Wfuvku4Nmrhb81Dr5d8 yKixy46xJtF7FZMFbHp0A0lmI3qEQIXQzXFsdq8T5mWNxd5I8I69uogrPMpqv9VulAT3 MG5Wl/60Wxsk2tUkK8258yVBryYqx9wJMrK0GWcUeT041XO/00Wl3xes/8fTO6KxeS1O +X4xMHlsXuNTHcP+OwMc0IC3fJqtNehyiGkF8z33QJFaHyH8LzYooHT22wb2NZQcHnUG 52lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sehUvhyN; 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 w31si14872229pgk.389.2022.01.24.12.58.13; Mon, 24 Jan 2022 12:58:25 -0800 (PST) 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=sehUvhyN; 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 S1355707AbiAXUWP (ORCPT + 99 others); Mon, 24 Jan 2022 15:22:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353729AbiAXUDq (ORCPT ); Mon, 24 Jan 2022 15:03:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A915BC02B743; Mon, 24 Jan 2022 11:30:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4932460917; Mon, 24 Jan 2022 19:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C659C340E7; Mon, 24 Jan 2022 19:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052619; bh=n24qRYqs69SLP+bZsZjrTUPpasACZLw6mwuMP9L7Yno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sehUvhyNmnJBRAuiD3MvP3HlrE2MViKpjG+v8LdS0MvBP272xuI08X1zD4T1xsWrk EEu8n9GFVcHG9UtRfEb2iyTE8CbJR/v1QglWVaT82kWivMrgnEGniCi+xlIkV2JNWR N76xYKlpjKXmA1B5QYGskwV/5A/VfmJCZvTTuCuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.4 119/320] can: xilinx_can: xcan_probe(): check for error irq Date: Mon, 24 Jan 2022 19:41:43 +0100 Message-Id: <20220124183957.736043608@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Jiasheng Jiang [ Upstream commit c6564c13dae25cd7f8e1de5127b4da4500ee5844 ] For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq(). Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now. Fixes: b1201e44f50b ("can: xilinx CAN controller support") Link: https://lore.kernel.org/all/20211224021324.1447494-1-jiasheng@iscas.ac.cn Signed-off-by: Jiasheng Jiang Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/xilinx_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 0de39ebb35662..008d3d492bd1c 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -1753,7 +1753,12 @@ static int xcan_probe(struct platform_device *pdev) spin_lock_init(&priv->tx_lock); /* Get IRQ for the device */ - ndev->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto err_free; + + ndev->irq = ret; + ndev->flags |= IFF_ECHO; /* We support local echo */ platform_set_drvdata(pdev, ndev); -- 2.34.1