Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp557251pxj; Thu, 20 May 2021 16:10:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2rMXV0OLsueGSSvmHZtmuYWgeF1RyES9tG0kFgcWudGBOz5E3eR3bk5iFnmNvMBe8y1ET X-Received: by 2002:a17:906:71a:: with SMTP id y26mr5029870ejb.491.1621552206767; Thu, 20 May 2021 16:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621552206; cv=none; d=google.com; s=arc-20160816; b=QuM7L8zw+GMYS9c45KmPyCsReX3SRMtFGrUpDSA6aR+oaNLD7dlf8Fg/f3rjJFhSDA bDVYvblrbrC7b2gpx61cmJsDpGgS2g5dll/nZi1jcKh5jRr5exyDwUSKiFZmn39o4Xiy G5Ptfv5CrSAKkll9ylvh3mBKiwak9J7DzyLDJrVJ9tvAQz+d68pNA2+Z4MaZ+9NluH1U tOmDP0z7XlDGMoCF2tq/1Wz+etVLuTwblBzvRqAOrH+s7oy48ykO3S5Q00MGbAItoU2e mgYBm8lnc0HD773RuFdIQLJb2K62RNqlkMQ07MmrDMwz4EOPbP732evBvleVPZwUW+Ie VyTA== 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=OAPnqM53AJu/u+xQYwsqGO2fo9H99tkDG6cdoWNQSjI=; b=IhhmrtoDsTJlrFUglj7btgYpBgBY7pSotC2O29O3ptKocwMYC2A72/8kmDO6yaHGSx e6af3RL/j+heQ6okJD/WevrjcWoDPCVDpcTRgUKHZF4iVYimGmg8HywCRiKbKrxCnFPq gRisHb3ZuPtrsV/twBSyW+5/hLhTd7ikaL9wDmZeB+qjMHwHKBITO5oaU5T0Cci5YliA S7cxB1OHK4L9cHKXUY91ZVg5WsI3PUannmKzizFvbbV3U/oGup+OQOTxvea1nrxydtlk cAi6wP+VmfayLdQ1qwakMARrBhUXO84gJjQDV2xmlYmWBaIKBXdwYsvgYhheeWqxuAPq jSSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HkXsznKl; 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 d5si3508837ejd.323.2021.05.20.16.09.43; Thu, 20 May 2021 16:10:06 -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=HkXsznKl; 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 S240735AbhETLVT (ORCPT + 99 others); Thu, 20 May 2021 07:21:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:59276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232682AbhETLBD (ORCPT ); Thu, 20 May 2021 07:01:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B93C61355; Thu, 20 May 2021 10:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505014; bh=Z6UbPC3YaFr6xZOYx04oMx0zKfG+uYNupeNTenzyxoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HkXsznKl0xDwM7+qXVL2zaUvclf98NPdico/uHvDBtHpILajCyTF2s/XQj776905f pvyZKZ4BD+Zut8D8lBCRF57ig/B29iqO3j226iOu3KDkBr+J/SxGx8LXyFLh0Y8vKk 2m2eaVbHVGbE0cJG9qG+v6aJuviEKlyBWnOPLsUM= 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 150/240] i2c: cadence: add IRQ check Date: Thu, 20 May 2021 11:22:22 +0200 Message-Id: <20210520092113.684270469@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 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 45d6771fac8c..23ee1a423654 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -908,7 +908,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