Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4624157pxj; Wed, 12 May 2021 09:28:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVJPbyS3XxV1nC/Y6+MyIIC1EEI6xGwRzZPBi3UIWbp5tskHMI8FCIcPedcmSkcGhf1t5v X-Received: by 2002:a17:907:628a:: with SMTP id nd10mr39089867ejc.326.1620836922962; Wed, 12 May 2021 09:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836922; cv=none; d=google.com; s=arc-20160816; b=LmXLUmyn4/hKIMLlfMNGhvyrwzfUaD9+mbHLaXz26+RNrOGoqMbOUQT2yL982jBFNb NQ3F37Ee53CU0okS7zmE1BSciCGa9xtBhxjJwM0xguOVKusStnU2FjowCU+K/s45vaNs AtaHioEWRL7BhbtD4JkNsO89dtR8k+2kvp4EJRNCbqDbVdgK1UgRTC1S01AjWwqfCi16 VHGk1/I7A7fOCfU6PBZzALjgiO5bos4mLI22F+lAVFSG8pvBxgCPnLycMbUy9yYBrqkb Pm6NrkWvT72GPZaF/BvhTVGXbXW4i3F4jVE/KPChl7ZlsBz4vrKl4J5DyEiMt+dwYFwA SHyA== 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=VgMre0rPG++aZrzq/ma9r9/buroGRqeZXHIlv6N3oZQ=; b=trJ3TO601Rr/G/SnYqoTG0tc8ExrQdh6C1sWGR4Z99kZ84URCYK4eGaAPenPIE3GNu EtkQYPetC71OFD3CRDzJd0fRjCMz8SfCElUvAjLVAUaLZHXHYubXQ8XANU4L+0mThGqv mVbuRWMiVLcETN6sKQ48pZG5AFNCU41+Zc+uLQY1xcV4ee8Pthn6VW8hrlmfnLc+Bk5Z c128fFB5hS6lvVkGIQJo1nBfCSmm+M+1QRJTVWntiqXTJX8vOQEYfhC8Lxd/3N1JXJwA nvyHiJKC1MAgyR4kP1wODkfc4zuWs4U3suXxe+yExl6uFJ43st7dxXGNc2hwDoQ6wJnB Goyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Is80Fq/e"; 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 f22si9059edx.581.2021.05.12.09.28.19; Wed, 12 May 2021 09:28:42 -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="Is80Fq/e"; 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 S241770AbhELQ2B (ORCPT + 99 others); Wed, 12 May 2021 12:28:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:57086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232449AbhELPiZ (ORCPT ); Wed, 12 May 2021 11:38:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCFE661C5B; Wed, 12 May 2021 15:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832822; bh=YDPLtz7CxpJbrCQhDSgIeHS1+CZ6obzzbeZLnNtuQng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Is80Fq/ed2hEtR2clakKCo15vJ3173WvMuwp6/c8I85YreEzv1P23hwcT/1fpsIyK 8sZ06tX5mpyKzf6Jp1alhZqF7Uj8t8SxjGBQCEVzzBoyTWdY/WWTNZWTAaTxj4cRUf zxo30nrUAN+FUAk1y9v1cxY2VfkSmw3pfy0cDbSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Wolfram Sang , Sasha Levin Subject: [PATCH 5.10 436/530] i2c: cadence: add IRQ check Date: Wed, 12 May 2021 16:49:06 +0200 Message-Id: <20210512144834.093681409@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 5581c2c5d02bc63a0edb53e061c8e97cd490646e ] 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 invalid IRQ #s. Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-cadence.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index e8eae8725900..c1bbc4caeb5c 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -1200,7 +1200,10 @@ static int cdns_i2c_probe(struct platform_device *pdev) if (IS_ERR(id->membase)) return PTR_ERR(id->membase); - id->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + id->irq = ret; id->adap.owner = THIS_MODULE; id->adap.dev.of_node = pdev->dev.of_node; -- 2.30.2