Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2119028lkv; Thu, 20 May 2021 03:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznEHGPAsmx4Mm58sM0YVwuljmjpsiLOQipuOi4PToO4IACBEPjzbBtaHpubtxZJXDOYGUR X-Received: by 2002:a17:906:5617:: with SMTP id f23mr3905774ejq.298.1621507917352; Thu, 20 May 2021 03:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507917; cv=none; d=google.com; s=arc-20160816; b=eKnQDrmILwOw6sih2B4/VffDNB2V5ON9/HJrgQx85bX4GF77igxvZCr9VLOMbtSX8V io4f5g0jp7+sHDig0sUKxv4IqNhHRqFMV1MliO1UdRrwtmPjN4a5OVJkL65STSdbkfb/ 1cVhbh8XvzqkYT6Xc+pbmKTmss1gIhYePcsI65HZiuS2f4pajsDC22PIzyZ66vRBlkuT HeuiR665HPm4qNtjPyyNNz6K0IhE/tGFSjDYMM8fP10FHG4txNDMGN5jGeZaVzv05g7P 1U4ryQDwLeW/77z8U1ePvvVMapiihu2abX/jPKUJAaNYeHBB0N8Zx3nvU+9GuMdvhdP9 o98A== 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=vAEGENmhTAFqEZ0YRIh7qBGxsITFEYpNMZ7M7VOLrNI=; b=b0DyItoCnNsDRb9uqnpKBL4f8q5tI2cDjB3yqVaxgKyBiBqPC7icdabXzdpHyN5OFP M6OXwwxyBAMRiyGpkUbA9W1AMSc3o6xFCgw5HcQegLjL+6bktZn4ysclWXk6kzTEnY5Q xOF8xsBl9UizbS/bFAFCSyucAEmLn45HByl397JQcPhyfUY8Nsd2N1DFrc2u2dBBpLye oazuOJNN1UlCY2olq9exE0Js9kPFsjQeUM+PTJvGDY80sOUZIKBMfzshy8hyfO4DNpLh 35QHM3AwvZLfq4ri4QUm6r36ADf8BSPa9AHZyLgPYXfiOsgOxGpVJCme6VDETReh9ipz x1LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z1OKEBLO; 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 bj9si2318700ejb.518.2021.05.20.03.50.44; Thu, 20 May 2021 03:51:57 -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=z1OKEBLO; 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 S238112AbhETKsj (ORCPT + 99 others); Thu, 20 May 2021 06:48:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:37944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235867AbhETKdO (ORCPT ); Thu, 20 May 2021 06:33:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 470DD615FF; Thu, 20 May 2021 09:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504360; bh=Eo71TZ2kJtI1W2NPQyoKBsunAnYppaZ7a2okXbh9e40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1OKEBLOawa3jWufHq7eVhZ20WxUUFSrvQYRqM7MBvGqNgtaQnt2ISqMA314nq68/ BL6K09M+W1W+q9rRSvgfO/QWRKm67af/FTjfY6wKmh4PqmtfATRVDIUHvbXJ3L93U1 A/o0IGOMxxxDICRacMILGWjc9S0ljteEXBZgO5Sg= 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.14 211/323] i2c: cadence: add IRQ check Date: Thu, 20 May 2021 11:21:43 +0200 Message-Id: <20210520092127.359755637@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 b13605718291..c5475bb4fae6 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -906,7 +906,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