Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp546830pxj; Thu, 20 May 2021 15:54:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRKBIPeXE52H34N9yACvTMNhbnwqnv7YIWMnMqFHWIghbrcGsYkljuWMqClTrN8IxhJmOR X-Received: by 2002:a17:907:248a:: with SMTP id zg10mr6705282ejb.259.1621551276669; Thu, 20 May 2021 15:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621551276; cv=none; d=google.com; s=arc-20160816; b=fpm2Bwf1py/DP80eXZ76ngqJaXJPxADxlzjGljHP013VCzq5VouHAT7hBQn57Gq3lZ 00/dykg8cGEi48bB4SSpUpHlJcDXjqe+eS19/68YIpznM8szNoJi/kCbn45C2bWz+eG+ udCQud/+eifr2fp3oLEha1PvS8C6KQYz8z46qkbwkBBpC+nMJOfrzYdU1094dfGqK/Rn 2EfbHI4ie7Myqg1aPoJo7HDEEKFzhxmcDebB5Yw0BJxmm0g445DBYCj7rX7F80sczElz N3+b+pVBcXe7YezklxZ+A0MAB6zpctGOmJeMeQtyElF3ykhxuK8/DXT4Dibrert6ON2J Mb8w== 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=YwYI6BIa+eN7yYOecwT3mox2yHDuAyO8HpQf7crWY/puv38Cj02s7jDArCQdSVFNfS 7fBJwLiw3jjZx0REXQd/b1AKG3/7+VRXOadfGYlXLtI0h7zc2MHrJSVJ+kIUNqusfaso vuz8xRCzmq3rR+mLHqvyqq8QukgytW5jgYZqeFADNrtDgELA9mOeM7cvUdZDQRS4MPVX hz0xweFTNuFuzc9JqGmZKd3Fd6NWWLTZ+jvxzcgKQDuJDsYviAUVpAcM5EDMhgMwZdSw LDWFvFGCAcl89AEWK52BRyLf7PLGLgjjHLgpbbSPPYzTzzfRf+mBosKTb30QGp1NJsuC tRpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z+VF5GtZ; 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 hs11si4830899ejc.319.2021.05.20.15.54.12; Thu, 20 May 2021 15:54:36 -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=Z+VF5GtZ; 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 S240302AbhETLSa (ORCPT + 99 others); Thu, 20 May 2021 07:18:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:57186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239182AbhETK6W (ORCPT ); Thu, 20 May 2021 06:58:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2382261CFB; Thu, 20 May 2021 10:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504945; bh=os3IdbjtmowGQlAp1NLTz3BkNBLLRVYjWB6eNY2ukH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+VF5GtZ4htZyF2GrjBq+kv3zUGTnAvOD+B0ngPkxbz9Jze23yHntBOPtb0fqeotV QLSddLIXD7BXKZuLPoNYVghJ6TV+rA5ZjUX0reT6cplVBsuJaCqsLlT0LrxSovpXPW P+fxLHascGt0uPTlYP2ZPNyoGKIPFVGEvIpF5wiU= 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 4.9 153/240] i2c: sh7760: add IRQ check Date: Thu, 20 May 2021 11:22:25 +0200 Message-Id: <20210520092113.778651825@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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