Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp557324pxj; Thu, 20 May 2021 16:10:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7yWxA1H2ADODKhl++5Bpbit2miHVM4q85w1eCcU7Krnb3NZaf25m9bzXpI68S9Cv0Od2i X-Received: by 2002:a17:906:60d6:: with SMTP id f22mr7046827ejk.177.1621552211713; Thu, 20 May 2021 16:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621552211; cv=none; d=google.com; s=arc-20160816; b=LZ8ALwYWwfXQ1aUniB5O0Sh/W7VX6ei9bnuFLbPrP9fKFqmZzDWKP7iFCEexHdHHZa bdmEs1yyoed5ScoUMFtRFGhlag8zsKlLJQK1vWA/TF9JbHArYjhp0YRvKkpmWYTqSsWZ DXp2gXDuIo6VlXnxK48Gw65z7TORaMgRQfsssmvcWYlJH2+POQeB8qF7ns4HoAvRCs0C LtSRS901fjTk2q33f1hH0nWRm5U8jRWK9DBpDu5AAdO+0B4E04oj+YqsOeAPxkdXB8Xo 6qTAQo9Nr1T24OvJiwjSf1bbJ50Kqv6LseCl70sgDWUwY6t9gmGGf2v2XB/WN65MScJN ANuw== 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=f6bD8KAfaKS5VC0c38N4DIBm2tsVf9P/CT5Vy0EAOjA=; b=QFfz7YEbe7TuMlgv4jtFLiF+qy/J78CZiuqk2iMRJFHANcxuzqy8OTV+nc7BodCWig 5Alyhy/FjssCFtVBRo5XpMurjiXRpAEK1vBNqa6An6G4tToiftg2uaujz2HIRYq0CZ7j 1gnxrz4RO5w/fLc6AKHhB9iK2OyjfIIPVzelUVyFFpefyBvnZohFeREBsSYo+jwTxJvx yij1zQhndsyYc0fMm9M27kSwwmFoen3AzNzP6fcik63atzkTO3epg9CV/Xvgnaqdp9LU GQZwUJuJjWfOMqn8F6RDuJCxn7w1ljkdYWrdY5r54px6GCdUtrfffoKhh6QGVBSIzFEA iUNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pv65bp3T; 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 en9si3846837ejc.84.2021.05.20.16.09.47; Thu, 20 May 2021 16:10:11 -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=pv65bp3T; 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 S240778AbhETLVV (ORCPT + 99 others); Thu, 20 May 2021 07:21:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:56262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238830AbhETLBG (ORCPT ); Thu, 20 May 2021 07:01:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01C4361D0C; Thu, 20 May 2021 10:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505018; bh=JGXEqjWma7AgE3RhLC1Xlae9sabD63oegoORVlnqXP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pv65bp3TLw0wPCu1ncywDillBWH+q+2sAegNGeTdhyxQ1CQtmm2IsbaUcAQX/RwO+ bjU1XM6OeJnA+GpTIbXfmf+xpW36Ku7i7ht0XltnS4LVqzKes60fNljDDxeghGwhzB 5eGjHDJuNBum0vffzebLgaofNozaLccr6wOROHsQ= 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 152/240] i2c: jz4780: add IRQ check Date: Thu, 20 May 2021 11:22:24 +0200 Message-Id: <20210520092113.747003491@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 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 41ca9ff7b5da..4dd800c0db14 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -760,7 +760,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