Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp417659pxj; Thu, 20 May 2021 12:20:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhVuAKqV2qDgZtgC/qhf/FmjxNhtZ7f/D3eJsuLc9mNynIlYhPEIA4HXvaSk7XtYsIIe0A X-Received: by 2002:a05:6402:2064:: with SMTP id bd4mr6471318edb.96.1621538436440; Thu, 20 May 2021 12:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621538436; cv=none; d=google.com; s=arc-20160816; b=cv66Zy/KN4Sf80SQCH06WLMarggc90gTJf35da9emRT1DZyWyJRB95437baImTEaHD k9Z4+N47gA8am0NSepob8Zpf17+k4jNbJ/pJprXthxrnKRjwD4AR5XsyzYli1ORb4k0+ c/e54s0O51i/CcFYQwdKggy6vcebOlZ8Y57a2iLjVgHDC26M/EI5wLmHq+cH3Gs6FJUd KaBcjiqKchEJcukjnZx/zRjJrV8aH2IUw8r/1nXCnEDoPHFc6YRyxlY5BHYIuGy4d6o6 OHIOms/HPXeNd/zgS96SV8CAH7NkrQbDN6Ezohv4jAz2Vg/uTdXza3++O4k0N3LadaI9 miYQ== 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=izB9Cm3PmhlD8mCK+YzgP2PqnicxbQtpfraYGMSZYcDLj07odpg/bRURJJn3Gq2UPB POoEuli+DouBzf2WUkoLG/vtBH0RQsQm8vpUHEYEGh8CWP6P+3n61in7AhtzanGlfsfT xawJ6N2rt/xVo5LeuiWBWf6flq9LQObRzmvQr+TOzWWssd/NPcJ4GRIY3WOIzpvJy02+ oFBdjtz+RZOd7AwjHaBpj0EdpvsXMrzCEE43JMrmp76oIym8hXxxCgLZUhEz2UkAIEHz 1YXadXGC+6lotMSN02iZsXLukmkw9bBtM68F7l3O19ECgNTJY+uyLyu3jp89/6nTL/YO DSmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o4KIuj+t; 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 i27si3106246ejh.691.2021.05.20.12.20.13; Thu, 20 May 2021 12:20:36 -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=o4KIuj+t; 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 S238132AbhETKsl (ORCPT + 99 others); Thu, 20 May 2021 06:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:60372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236945AbhETKd3 (ORCPT ); Thu, 20 May 2021 06:33:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8613861C4A; Thu, 20 May 2021 09:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504365; bh=JGXEqjWma7AgE3RhLC1Xlae9sabD63oegoORVlnqXP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4KIuj+tOIf1rYwrV0uidaVWT3WG5DMg3wqwoIHrOERaZTHeVlJPjyfkOWq5nL3wE VzbNhRnD2XPuf2daJ6dal4YYHYHD7q8rlxBw7eM7dU8jTtFjuPEv4LjkUhXz1enue3 gKi9wBEgYJoEYefuPYZRIaQoaq7OnzPr9WSezbYw= 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 213/323] i2c: jz4780: add IRQ check Date: Thu, 20 May 2021 11:21:45 +0200 Message-Id: <20210520092127.434400678@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 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