Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp632463pxj; Thu, 20 May 2021 18:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUOAh1Zo7751AmkXQbvYtqwhJwUnuMPSFs4aybjweMjD3g9Laqj9DFzcLTppfEE0J6wlGy X-Received: by 2002:a02:4844:: with SMTP id p65mr502705jaa.102.1621560537431; Thu, 20 May 2021 18:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621560537; cv=none; d=google.com; s=arc-20160816; b=KIbCpuy+p8FVxDLoo36rZS3tikHMDVyUQBcTCBUJahuu9/lg9ZkTyxw4/BSA5Sb5B5 pMbVIu7KfXvv8TauCyuF/6M5/oXvGqXqvmLWMWujtZZhuom6xPt4begGxI5d2KdFgVqG 0cSZox4JJ6MJqGXogwvinNrQpNDD2ay39QMuMGZ5IhsiaTa8gk9mRSqxV7+Mfmx2n9dM nLvqbnpWpzSIHFSdYnXnZCBDBqgUyKCm+GJXj5bY6qWVWWtSYRlGwKivhSJTIxtOBD9i mnbzt7yLFNQfiW1/X93h0I8X7K3fnuwMvNjseVoghJyUsFv/zeLg4WyNOsjT3qPbQtlP +CFQ== 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=rVlOyWkgH3vSIy/mMCkNA6vFiLDQJPtJBwyqpdQU7j8=; b=T9kV6CqqMEJQOL+vsG1gUIYfmaDLetDMFAwnUDKUs9GJg9tSnD1CUWW8iy8IqBHlnR P/NeMy9xQqo0Pg1tOPa4y4IcpbPKI1+Mgq9d2DadiEAwjrGzU9zPieewv+jCyBTh6H/g lghCNjAAtXbbDdsKvPWAd75KRTqQW9M+1Sn1QPInrkEWBPKceJb4sRzQdGQkKdpJV78k vkoUMswGbMuoFOri8LAIx5vzDfeMtYCLz8VM3kJCJRjBjL8L1ejI9xtnRHSbtCgXdw1Z aqOhETqOG4qavmDz1Xsf6HXMzc7cfXr8fyZm/dch/ikJApuAJ3VInjP0svtw6o3xahye GUHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NHwc72Kv; 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 d70si4497947iog.4.2021.05.20.18.28.44; Thu, 20 May 2021 18:28: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=NHwc72Kv; 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 S241264AbhETLia (ORCPT + 99 others); Thu, 20 May 2021 07:38:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:41684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239750AbhETLTA (ORCPT ); Thu, 20 May 2021 07:19:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07F0461D6D; Thu, 20 May 2021 10:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505406; bh=hoOV61RPo1BDdbew5cwtAk8F8ixQSjWXyd2PzkDI+Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHwc72KvTX8aHQtXzOBiAt5LSx4z5oOPkRbv7aVc3JiLZKjyxXazYzHo/yJMLCuFl Xhw5xUjmC2MuICcf4ZqQRtUaOyL+tSa/r4X3rWyaFCBp8uQx4hsnpDxdCVij53Ax3w hD8vzVJpGNci8CiN3XncE3UWLoaH+h9EZtmJqNKo= 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.4 121/190] i2c: cadence: add IRQ check Date: Thu, 20 May 2021 11:23:05 +0200 Message-Id: <20210520092106.206716721@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 84deed6571bd..7d15c9143d16 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -894,7 +894,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