From patchwork Sat Aug 26 10:02:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 717676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5AE7C83F01 for ; Sat, 26 Aug 2023 10:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbjHZKPo (ORCPT ); Sat, 26 Aug 2023 06:15:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231745AbjHZKPe (ORCPT ); Sat, 26 Aug 2023 06:15:34 -0400 X-Greylist: delayed 382 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 26 Aug 2023 03:15:28 PDT Received: from out203-205-221-239.mail.qq.com (out203-205-221-239.mail.qq.com [203.205.221.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B977A1FC3 for ; Sat, 26 Aug 2023 03:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1693044926; bh=E32l48gh74u0wKPcn5axJaB36BSlQqywiLukbAdXIo0=; h=From:To:Cc:Subject:Date; b=ppvpDp3dQC39UCPCCW2eTyZUjPczU60GdOKaA5vtwL3cIGst5ah3qYbsehhTaKEDs mc/0PM5VGML8cidB5uNVYVZTwfjKly7uVtg4LTDK3vZoK3cvkG+gwlzw7hoDTKLltR FQMGTi5gvBMemuQLaVOZwFPKU8xBEawjaz+1aUFs= Received: from KernelDevBox.byted.org ([180.184.49.4]) by newxmesmtplogicsvrszb1-0.qq.com (NewEsmtp) with SMTP id B702291; Sat, 26 Aug 2023 18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r5UbCEGYe8TD2si4XQWpQizhWNDDL4OnHI= X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: Zhang Shurong To: ldewangan@nvidia.com Cc: broonie@kernel.org, thierry.reding@gmail.com, jonathanh@nvidia.com, p.zabel@pengutronix.de, sumit.semwal@linaro.org, christian.koenig@amd.com, linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Zhang Shurong Subject: [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe() Date: Sat, 26 Aug 2023 18:02:54 +0800 X-OQ-MSGID: <20230826100254.2197256-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This func misses checking for platform_get_irq()'s call and may passes the negative error codes to request_irq(), which takes unsigned IRQ #, causing it to fail with -EINVAL, overriding an original error code. Fix this by stop calling request_irq() with invalid IRQ #s. Fixes: dc4dc3605639 ("spi: tegra: add spi driver for SLINK controller") Signed-off-by: Zhang Shurong Reviewed-by: Helen Koike --- drivers/spi/spi-tegra20-slink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 4d6db6182c5e..f5cd365c913a 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -1086,6 +1086,8 @@ static int tegra_slink_probe(struct platform_device *pdev) reset_control_deassert(tspi->rst); spi_irq = platform_get_irq(pdev, 0); + if (spi_irq < 0) + return spi_irq; tspi->irq = spi_irq; ret = request_threaded_irq(tspi->irq, tegra_slink_isr, tegra_slink_isr_thread, IRQF_ONESHOT,