Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4631399pxj; Wed, 12 May 2021 09:38:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCmPKk0Yx7iJYqg7vsrCBKtJpXzbtWSc/CNxIFG1vDKMb066xMh+Wat8CwBbTChIUpcnMN X-Received: by 2002:ac2:484a:: with SMTP id 10mr25267672lfy.392.1620837485159; Wed, 12 May 2021 09:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837485; cv=none; d=google.com; s=arc-20160816; b=xepdWP6TxMDZs5RomnA4MASgxeb7Bg1YN3DOYDTws0+pAqP6KZP6ngFM4dLm9xzVtv fWnSmepBvDzHfEKMCsTZkUVaYBbZJZRjmTcxcUr5yboOYGvc8MrnAXelBIcJ8wWFdFMA 4myzdDczisLvhC3jvNoJ3/2odJXgOkKtD9/C1xtikgdZKN6MRbKeAMtP/lPUSjA7Bx/t ImVO77TdQRWb7g5jcTq3fsWbyC6kJluURPBLkUpR0XHrMDLi/ysTrRpN/YrxjH7TO9pz AoBYmiLucOf0GSIkvj19Eg6PvyUr23UtpvJyYxuzcevcn0kp7FoIIrgzj8xQ+nYtLFxe narQ== 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=njWtf+Bos4u/Zt3jU+RDuvICjgoL2yUqzoD1Wc3TlTA=; b=qBodMKsZtgLSDBkTUfI/fbopa2MVVpjQucnn3dv1xXjOLHrld8hdo6zvRh1t2R3gy3 mmCdZgtIgTreNThExtO5DouoLJaF8NJLOe1+LCeSwI70OeG/RUkctfQftPkn8VBtTEtX pkvQrSX06qPYqDGM/aV2F5jOBSPiqf1cXmlDrg/3QYYkSwlmIh+1cjuwHokxrJP3+nb1 IdE5TNynmYOJk0aHCdT3gOYj4EV15J8iluKtcKY3bLINeWA6C77NHcwJFHS3liXxIFrt 5eVIZs6u83qTtSwMLiZzDm0XUvsYgHuetqXAj0bwAj9SSBh7J0xi3j/QEnHNgHjmIVbT mS2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="nMPYk/PE"; 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 d1si398411lfl.168.2021.05.12.09.37.35; Wed, 12 May 2021 09:38:05 -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="nMPYk/PE"; 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 S242075AbhELQbu (ORCPT + 99 others); Wed, 12 May 2021 12:31:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:55290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236590AbhELPk4 (ORCPT ); Wed, 12 May 2021 11:40:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C8A676144F; Wed, 12 May 2021 15:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832876; bh=Wyw02pBlIowNMubUOAZqGkILU+OwdGRv5Z4R6g5S45c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMPYk/PESRFVEZSW0Qwtlmm9ut1GDc1i7IEgSL1MIW+xbkKmee1ibNUwAi5o/Qx3D UljWkktbYWzju6TtUqv3Ssb2WLwVU29SOLIS5GpJaLlzICgtee1F5FJ8qFok4r3FoH n2SYoBfgpE1cA9Gxrv06RAqdKSlZfKjzNGxSgMS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Geert Uytterhoeven , Wolfram Sang , Sasha Levin Subject: [PATCH 5.10 442/530] i2c: rcar: add IRQ check Date: Wed, 12 May 2021 16:49:12 +0200 Message-Id: <20210512144834.301335945@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 147178cf03a6dcb337e703d4dacd008683022a58 ] 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 the invalid IRQ #s. Fixes: 6ccbe607132b ("i2c: add Renesas R-Car I2C driver") Signed-off-by: Sergey Shtylyov Reviewed-by: Geert Uytterhoeven Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-rcar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 12f6d452c0f7..8722ca23f889 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -1027,7 +1027,10 @@ static int rcar_i2c_probe(struct platform_device *pdev) if (of_property_read_bool(dev->of_node, "smbus")) priv->flags |= ID_P_HOST_NOTIFY; - priv->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto out_pm_disable; + priv->irq = ret; ret = devm_request_irq(dev, priv->irq, irqhandler, irqflags, dev_name(dev), priv); if (ret < 0) { dev_err(dev, "cannot get irq %d\n", priv->irq); -- 2.30.2