Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3866835pxb; Tue, 19 Apr 2022 11:23:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3iqtNP4alwVZDhQ/qMlTp23t04LONTmlhnhNQcWkLSP/W8wsXEnuQYHaGlC0TQ6qsDOSP X-Received: by 2002:a17:907:6d90:b0:6ec:9e1:865 with SMTP id sb16-20020a1709076d9000b006ec09e10865mr14227911ejc.369.1650392583318; Tue, 19 Apr 2022 11:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650392583; cv=none; d=google.com; s=arc-20160816; b=EzT00aGPraWb22TX85TvCr65+youPKQNit6qGOhwOybNWVzex4y3YPXk1fK7Bzf2Gv YFzwbkSoL1da7LHhnjKyyrAMxyE6g23sE2/sp6p6HbelZ70rMMKjNWg3E5tjoOIEnRyh feTtdkhlgg7U+L1HrwR3O3+1DsxazUYnl6DLPfRiiwTV9jyrqcMVs7Tt+NT2Ze0MEHEi vgUYrdCpUq1fK2lxcSFWb3/pjfgOKSNE5mMJaDqXhGtYmFMS4zrYYdbG/ohU0bmeCOr2 zP45WsTNsO3WKTkNwJKzDAnk7bu22bxY6oaRHitGuImPYz6vd2hbSJRWA88lWQZybEc5 bX8Q== 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=I2KARayfVNcpyRzExjDbdhOcsFIK34ihbrdJvfJs9SE=; b=MTWDPajFMQot4BXVWgHn1ILT/Ld6QkQSrztmNJlKVcZq/zbmC9GBXVMVsJM5zUIDzM ofiROUAZKW0wLHAr6Lp24T29Zqe2qDIGgqm1Zua8vyHu1+lGSQHjCwW5npyzLXo0T814 zUGI9L1D5Lw07n694zjlEcsZhTlmS6X2d3ImZvT55B1nNRxQIcrxp9sw/oXNP5aUhabB zEf+XuLHjMD5NycjCB2q4Qw/m3+cKmsWnfwESfXGeNYEtDHpz+Suxsz3oCNrNYBOwTR7 IGCjDUp7qBaCWBbJT2cUf2fNTAgNUu08wb1+76m0JiPO+4+12qbZHXFVYpiRNSRqW+qJ hvYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b08OYjPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kq20-20020a170906abd400b006e6ed377f42si8670619ejb.754.2022.04.19.11.22.37; Tue, 19 Apr 2022 11:23:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b08OYjPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S242933AbiDRNg2 (ORCPT + 99 others); Mon, 18 Apr 2022 09:36:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243538AbiDRNKN (ORCPT ); Mon, 18 Apr 2022 09:10:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6D30381BB; Mon, 18 Apr 2022 05:49:43 -0700 (PDT) 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 D6EC261256; Mon, 18 Apr 2022 12:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4AB2C385A7; Mon, 18 Apr 2022 12:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286182; bh=2OoyKwpv7vWB8e0xZfFtSi74rRIOR51x8Ps0LTdmj9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b08OYjPlvmmXv45aNJWpeTCWXcIqdn3iyZzYByia4QhdmHrSgEmvbEjGSUPYPiai+ wtGLW8g+FDaC7PkaN0gTOVRTL4SXRYJJjNj49C7+QkSDmtA0Z0ql8yluWHOJFSElmM K0SowosXT6jSiGAe2Wg8ukZ3asFEkUrJdncAXXSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 4.14 055/284] spi: tegra114: Add missing IRQ check in tegra_spi_probe Date: Mon, 18 Apr 2022 14:10:36 +0200 Message-Id: <20220418121212.259396931@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit 4f92724d4b92c024e721063f520d66e11ca4b54b ] This func misses checking for platform_get_irq()'s call and may passes the negative error codes to request_threaded_irq(), which takes unsigned IRQ #, causing it to fail with -EINVAL, overriding an original error code. Stop calling request_threaded_irq() with invalid IRQ #s. Fixes: f333a331adfa ("spi/tegra114: add spi driver") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220128165238.25615-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-tegra114.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 0e1a8d7aa322..9758b7f7e92f 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -1136,6 +1136,10 @@ static int tegra_spi_probe(struct platform_device *pdev) tspi->phys = r->start; spi_irq = platform_get_irq(pdev, 0); + if (spi_irq < 0) { + ret = spi_irq; + goto exit_free_master; + } tspi->irq = spi_irq; tspi->clk = devm_clk_get(&pdev->dev, "spi"); -- 2.34.1