Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp663432pxb; Tue, 5 Apr 2022 17:50:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFaHiY/1PFMgf66MHqIjeRlEPQ2oA0hwQ3BvAhVYmzueH162TyansxEioGw7hifoM8e43P X-Received: by 2002:a05:6402:27c7:b0:41b:51ca:f542 with SMTP id c7-20020a05640227c700b0041b51caf542mr6316460ede.149.1649206252829; Tue, 05 Apr 2022 17:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649206252; cv=none; d=google.com; s=arc-20160816; b=P42OAdhJseQT+DVcODo4ozikPqgJw3VdZaCGP2Weo2zT4xBadbc6VxaFLD3W1eZJnb OmqhtclN3pdlLyrN+HIKuEOyhmUoABRexEGV8BJ97xSkPn58e7xmSAegZEN7QQhC2lu2 KvYotu883HST/GnTa8yQzFJ19tz+8ji0X9/WP+fwHKbZatjZAx2GPhXeCsnvyBBkUn3e QEOorm5pyqzRZXJ3IF0crueOQHHi6klje+DQ4xTqFzmGPVfZDNWPPmXMPCdAwqepLZzs ftoqsuM0EH82zQrosFI8CSC3uD3McmQrvcfE/owIJFF6HPpQdGemdNhNnViiDRRVoZe3 MpEA== 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=LgeH16WeSqbpNGNmN+s3gywJOKmmVCC/WT/xqI4klI4=; b=S2LzfM1cPZWAYb/Smx8o/sjz8s1HHP582mu0tObIhwhA0S888BUr85jia3ggOWn5FU x1RaHbrYlEx5p47reMCS85ZucTUioglZDRRZipJDMQT4Hiqrtey+qQ4TQY0gpQYwBpQh XY3IR9hmYtHwiO0XLFd+Ad0tppzqATD5U1xj5BQXH/fwrw4X9i16hZcmTCSfSTVxUb3l JFhlpmXGQv/h/3vKJz/jiC4POGx7Y/QMGcfMVNJEWOrs9KByrcZJx2g3jI8hJ89qRJhF Hm/DMoqwbLIe2Hv1QLo2Wy0hU2WiLNTByE10Ekof7I4gotTuppZd7vG+aJtQ/FTLGb5e KHQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gTbGMc62; 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 t9-20020a1709061be900b006df76385d68si10039277ejg.520.2022.04.05.17.50.27; Tue, 05 Apr 2022 17:50:52 -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=gTbGMc62; 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 S1378195AbiDELb5 (ORCPT + 99 others); Tue, 5 Apr 2022 07:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244431AbiDEIwF (ORCPT ); Tue, 5 Apr 2022 04:52:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E6CBD5EA0; Tue, 5 Apr 2022 01:41:03 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1D58DB81C14; Tue, 5 Apr 2022 08:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78AECC385A1; Tue, 5 Apr 2022 08:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148041; bh=ChCoChCJ+bm2s/23Tdv+MYjgZvCiKzNdR0c3alOGOmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gTbGMc62rPkmj4V2DPdxHynrb45Y8KSqN4sgGVsAul1jADhCNmecOltvM1MpjGWLl b1f7IBDPXYZZNR8XQWndX7YUL4dpG7ieuGnYEUrS0eFanbI+fVZTQ765oYTUKGXFEs M/trcpXkfMRYCZJY4//MmmhKiYgiaze2YktCzHAY= 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 5.16 0212/1017] spi: tegra114: Add missing IRQ check in tegra_spi_probe Date: Tue, 5 Apr 2022 09:18:45 +0200 Message-Id: <20220405070400.544121890@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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.1 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 e9de1d958bbd..8f345247a8c3 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -1352,6 +1352,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