Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2118679lkv; Thu, 20 May 2021 03:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2TqrIsmTaKzqPDc1r0e7hA8oqQVwuExwzjZo0tyCnkLkEyHJsYflQxFWQe3eIKbSC4odF X-Received: by 2002:aa7:d282:: with SMTP id w2mr4291045edq.45.1621507882940; Thu, 20 May 2021 03:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507882; cv=none; d=google.com; s=arc-20160816; b=uNBwKBFUpQ0R0WNUlQhIl/VBsAhLWv5farg0yJtRu5AocgTRanM+hAvDnUStJE392I oNMDrcM49YwiVNRPX8D8w0KQ+HckV9Yfexk5RQZVt6nv6sdNdKI3aGnFdg/2m7TKkEyA X63pVWbzz3tmiRQGYFkA7wr5bUsaAshlXlAohqFWa2N0JqD5v0mWC+8vMeDKdNP9iEFl Zs2GB6Vb+I1FnKviLStApC4vG6ROVt1i7XaG3bXF5CdL2u7ahxodD1Fio+FueXeU3Yuo 1FGocWnnggkBhg9Xdouuh2P2Piigz1uD6yC+P1WQVAv8HJSwmbrzirspnillISxXUSyK PFhg== 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=la+0YTgFnQ5o9Z+1qbo7CEuc4HlaJmNTNLtyfZJ/lBk=; b=gCY2x29KaxDDDRt7KKJnCjUCV3c6joiAhBubbf0NgbzGpOnPfLYt1hfjiwhVuy2zR8 g9Rz6FsScYzbJBq27Ow9BEXi7FLmZKwTzfJmW+58+AxZhl2J73qbtmN8hciQEKc8pgoH sguCPcdMhqI4gYaZfzJEU8/afX4UDPkLk4cuA+kdy8CHRaYwAXVXGMp1gUeKJydlMTzt tH1wIitxNUL0fuZXev6XpDfx7HNPOKFwIP3ft/rv0oAMtvflyla6mQluvMZXFmA8C5uc 61v3kda+rnafJqi77uPz0IB2mVScFbVbJGUMToWpzULHEfh6C/a4fNE41J6Blx5zrTRX acvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vPF8OnJ+; 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 j10si938815edw.296.2021.05.20.03.50.55; Thu, 20 May 2021 03:51:22 -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=vPF8OnJ+; 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 S238188AbhETKsr (ORCPT + 99 others); Thu, 20 May 2021 06:48:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:60374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236936AbhETKd2 (ORCPT ); Thu, 20 May 2021 06:33:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5561961574; Thu, 20 May 2021 09:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504362; bh=hi863W5PdaPUR02yPzSXUUfps9KKRr+lBGMdRkKHK+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vPF8OnJ+Ti8AjgFtPvNqPtsTNL0656jT8XFDuacbCJGarOSgjGy38SpEnVukeERk5 bpgKELKkYwz60TE9fHceWjd+IU3NIjDw4Y3HRyyYA+qwoa9HX6CsKTO+00iM3pRiFj YvLI948vBuFIcTDJTeeZ7O0A5YY/zKlqQGkCdyHM= 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 212/323] i2c: emev2: add IRQ check Date: Thu, 20 May 2021 11:21:44 +0200 Message-Id: <20210520092127.403224271@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 bb6129c32867baa7988f7fd2066cf18ed662d240 ] 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: 5faf6e1f58b4 ("i2c: emev2: add driver") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-emev2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c index dd97e5d9f49a..74f0d5f2dc30 100644 --- a/drivers/i2c/busses/i2c-emev2.c +++ b/drivers/i2c/busses/i2c-emev2.c @@ -400,7 +400,10 @@ static int em_i2c_probe(struct platform_device *pdev) em_i2c_reset(&priv->adap); - priv->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto err_clk; + priv->irq = ret; ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0, "em_i2c", priv); if (ret) -- 2.30.2