Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4623843pxj; Wed, 12 May 2021 09:28:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDY8iUZu57CIntcjwcxK1M7s7EPItUrzRNAKZPyL27c7wM/ys3tN4wz+V8ZRUDlOJ3gTdX X-Received: by 2002:aca:a98a:: with SMTP id s132mr26973025oie.164.1620836897454; Wed, 12 May 2021 09:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836897; cv=none; d=google.com; s=arc-20160816; b=ZftVXBeF9gkTom6dRUhpoosu8LIF+VxEw6T9kZc9me8gxm++/twOFGATv2UcPI4Tn5 g9mHBbvvW7CivFps0DkBrPS0sdwDAVaM2sYFqFvtNUh011hdFqpFkRM2QCabWtpXCDfN 79TK0Nbokch8RbZY8Wftj2vhIVWIXUjT0tFSLA+tgnski5ydy4eN8KZsbFlAr3sYEgu1 iaNRxdMABcmQo+FvRSEFEq04Z4me/1cVx+wPYPr01aPtR6aeP2mDzO20HLWt4wRmqtQp n9f2859D0kwwrscmj+oUZIWAlbs6S9cm0q/Z7lCDqtgvydyZBwu4KKdqhdxgF/7DgHAa 3hBg== 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=/UkbcltmgR5Xukw501XpOy4y4TsQ87ULGha9T6xplVo=; b=C289x91s/wwH9wT58hXcuHnI+3aBjudN63Hlv0nxlL06ZEv2LYJYJJNbVEOD1oCxUb nSxqqJhx3xgYQNP/tP75RtFi/8ghByx3IV7Dm2+grhk/6hmPRq+4n03HIR4xnMd3lEfa 8BUCaa9i/g3By5fXXPihfRVxNIoyEfL8nUDTfVSCh/ksbk7kE7tHS8G3bh+H4cVe7/aT CamGMJFkorIxzwJZVwnnrpgrXWD/dDewRHwqxx0ArxYsxfgfKChMm3HZCKgCNw0oglh3 +EIUfpHmlEiyJ6dKzHkthoyUpg73NJc62N81E6JBq+YqSzSvmTxKloueA8rwnzl5YQGQ ytuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qDe1qlEt; 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 l207si411930oig.171.2021.05.12.09.28.03; Wed, 12 May 2021 09:28:17 -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=qDe1qlEt; 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 S235890AbhELQ2Z (ORCPT + 99 others); Wed, 12 May 2021 12:28:25 -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 S231656AbhELPiz (ORCPT ); Wed, 12 May 2021 11:38:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD5C361C60; Wed, 12 May 2021 15:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832827; bh=zc8zZmSbGv0fbHbctOE8oi5ff/COuMFjxNliAZb7iaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDe1qlEt54vYqvmVhD4YWGTrRwLrCeXIdSOxhnJRf2fuJ0hhIY2ZMRMQLFS/0GZrc qKi144Mur+5dYtV01TQZ19XwIDQX7gVdHcuayeXYr9Ola2Oop4p4XkVCnaN8ZLk4HY EviW7zVnouuk04FLrBr9tRhK1li9eLX9by0kcpQY= 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 5.10 438/530] i2c: jz4780: add IRQ check Date: Wed, 12 May 2021 16:49:08 +0200 Message-Id: <20210512144834.169507330@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 c5e5f7a8d931fb4beba245bdbc94734175fda9de ] 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: ba92222ed63a ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-jz4780.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index 2a946c207928..e181db3fd2cc 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -826,7 +826,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev) jz4780_i2c_writew(i2c, JZ4780_I2C_INTM, 0x0); - i2c->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto err; + i2c->irq = ret; ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, dev_name(&pdev->dev), i2c); if (ret) -- 2.30.2