Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4634497pxj; Wed, 12 May 2021 09:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR0iL87PQqM7CyZAA+uXeXqNHE/LZxHuzWmJcxWmhzGIT2eqNvqBa3bvbqWXW91Xp5R8M5 X-Received: by 2002:a4a:b389:: with SMTP id p9mr28230018ooo.71.1620837754715; Wed, 12 May 2021 09:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837754; cv=none; d=google.com; s=arc-20160816; b=ShXn8+mBgrXrdOWNsDPKwr9l2XE4Tif4Vm11+kFTzk9LsTuXSh+AADSYsKWeiHFgLu nYy5QaF4JUf2i0cKFpPdEwz0zrETJnVq42ufi/t6NNUxydxFylEL5bMKu643fq2Mvfzp 2Hy287RBlNC+JH2BbF53mpfYW2b9+H5gfK29HaKF06SB/2aoOZLRgEx0mkpjsKOCLnSR EINhfAu3URFWi/b/OFFCYBczPCN5AIhPbzBoPBeq3ZZU8bRFApBXH1Ef6SwJIyxmC7Jj VRNCVyCf8s6AXgpQWwfyrDiw3FtEjCrLkGrJ1w7iJy7BH3HKpUsvdNbF6or0du4BPaT8 2EpQ== 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=9kSqDDLmpE8uB2Nz18Xjt5vTSSki53/KUQKIbmiLd6o=; b=L7rtLQwJx2AO3omMj6YVrsGanmNlUEk+rakcadil2z1ufxaVQqk5/fca3Rc2wQee5B 68nmPvj8eonIH2cjnet29v75hkupNSOmip4V6G6335Scv25RIFyGVqgEmUKBTkT3iKI9 ltzmw0LpDPw/7tsILYyZvJJ6Kov44SqJe45kTKXna2qMFDUOj1sGyfdQj6ioRbkqBVeq V+G8+RU5wBgvM5t7JS7P+GPwtCuJft0wQE2cAkdM53c0ImijhD7XCYDIEDmWrt5J01tD P7rh5mm53HRwSH+ImT+UtLue38CCz1Yo/diKc4rwgRfKGfFl8jKnk5Xsl225hcLxYoV1 2Nvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xckt4/Ij"; 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 u72si360223oif.179.2021.05.12.09.42.20; Wed, 12 May 2021 09:42:34 -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="Xckt4/Ij"; 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 S242478AbhELQex (ORCPT + 99 others); Wed, 12 May 2021 12:34:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:39558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234931AbhELPmJ (ORCPT ); Wed, 12 May 2021 11:42:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3245E61C77; Wed, 12 May 2021 15:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832905; bh=os3IdbjtmowGQlAp1NLTz3BkNBLLRVYjWB6eNY2ukH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xckt4/IjRSycCU9ARJL0BiWWmep/VWYwFTkZeOQ+vaCPqU8/4HIA72eYpMb3db7Ni P8lrOju4a+957md6R2LO6QxNiRHTKEGAzEPe9TByQmHVeS+ua5HSv6YJ3jY0iJXHgs hIdgZ6anM0bpEvtSjhCovNiExgc+ZAJ9jcMq7IPs= 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 443/530] i2c: sh7760: add IRQ check Date: Wed, 12 May 2021 16:49:13 +0200 Message-Id: <20210512144834.331587757@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 e5b2e3e742015dd2aa6bc7bcef2cb59b2de1221c ] 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: a26c20b1fa6d ("i2c: Renesas SH7760 I2C master driver") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-sh7760.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c index c2005c789d2b..c79c9f542c5a 100644 --- a/drivers/i2c/busses/i2c-sh7760.c +++ b/drivers/i2c/busses/i2c-sh7760.c @@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev) goto out2; } - id->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + id->irq = ret; id->adap.nr = pdev->id; id->adap.algo = &sh7760_i2c_algo; -- 2.30.2