Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3798370ybi; Mon, 29 Jul 2019 12:50:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCxr1AU7hE4caT+mduCqHvIl53KRGctPH86T38prLFFCHUnMaIFsGZNl23r4sCmc4STsFw X-Received: by 2002:a63:c23:: with SMTP id b35mr71946027pgl.265.1564429835256; Mon, 29 Jul 2019 12:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429835; cv=none; d=google.com; s=arc-20160816; b=Gc3bs3Bgl0CTVkl9uk9C0xKoHhmaDw8dCDlaCKviVanBdCaRH6qs9xqEJNBkKgt9h1 rdxxaS2elUgDyHnjvdl0PwmVOLuEXJeZbN4KLHAyrBvOgoXQNoZEvkJv5gFa5kVGl7P8 5ue2cMU+BFH6Aph7QNkooEI5VDBtlAtO50WBcF6SpIir9mw7kYpgMkTkFq0ZlwG8W2e+ aCkuV4khysRlXH2Qs3GMyhgoKI9+FPc0HLTCbTrJgCjGD3H83Mjpapn4ET1BhdRZ2x2O Rfi3JP7SVEVZX27UwbrzNq0bJF/77D6nXXQ+CO90GxJofAM50LXSMlTD+seInhGc8qfF NfBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=39mF41mr8eUz0Akl3aZrN00vpYblKfDDrGjJjpn5X1M=; b=Tt+BlcKKLa6IS3LQdgvQAw7M7E7VZqtvswWtAk1bokKJxjkDSZi0ETMTCyFWdhAfnD TWpuo4HlUR05tJwWu+4tVR90hbkTIEKxZ/6QKxB/f2LoHQ+n6pg6ViBP7ELiUbae6pKL P/wapBYcUMDI5/Ir8USY4DFgzIa9GBSWIXKtU8OCN7yqlBfZzRYl0o9GuYmmtHFIOb+A u+jlbyffUszHPWsdu9I5UwLhLybEtSekBAnhPoueQMjeo1BuDahPYxuVTN51RicV9/wu QvJ4pM78W4uYWref+mSleA6SRMnt2y/7EFX3+1Tv9nsmtWY/K4lc/xG+xrfq/ImxTILb DMwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iCzaObMc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j66si25074128plb.375.2019.07.29.12.50.20; Mon, 29 Jul 2019 12:50:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iCzaObMc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390477AbfG2TtH (ORCPT + 99 others); Mon, 29 Jul 2019 15:49:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:39468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390471AbfG2TtF (ORCPT ); Mon, 29 Jul 2019 15:49:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEB3B20C01; Mon, 29 Jul 2019 19:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429744; bh=j0lY89zL8lm04jqxntNdtd32n6H1hVaxj2cQkmT5++4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iCzaObMcqNwjOP1XpCWfbb0GcnMFuT4sbVpHBxhJETTyoGCnN5if5ExNZILdVlpKA zJjB4AfATrYuIf48OT8sw/KOWB3Xj5knI7vn/7YwdsVfspt0N3p1jr9Sb1FYIBETOc bEXgJIJvRZG4FS2lcfCURgReptA1NxS+BhWYOwCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Yves MORDRET , Fabien Dessenne , Fabrice Gasnier , Wolfram Sang , Sasha Levin Subject: [PATCH 5.2 082/215] i2c: stm32f7: fix the get_irq error cases Date: Mon, 29 Jul 2019 21:21:18 +0200 Message-Id: <20190729190753.899907991@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 79b4499524ed659fb76323efc30f3dc03967c88f ] During probe, return the "get_irq" error value instead of -EINVAL which allows the driver to be deferred probed if needed. Fix also the case where of_irq_get() returns a negative value. Note : On failure of_irq_get() returns 0 or a negative value while platform_get_irq() returns a negative value. Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver") Reviewed-by: Pierre-Yves MORDRET Signed-off-by: Fabien Dessenne Signed-off-by: Fabrice Gasnier Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-stm32f7.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index 48337bef5b87..3d90c0bb049e 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -1816,15 +1815,14 @@ static struct i2c_algorithm stm32f7_i2c_algo = { static int stm32f7_i2c_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; struct stm32f7_i2c_dev *i2c_dev; const struct stm32f7_i2c_setup *setup; struct resource *res; - u32 irq_error, irq_event, clk_rate, rise_time, fall_time; + u32 clk_rate, rise_time, fall_time; struct i2c_adapter *adap; struct reset_control *rst; dma_addr_t phy_addr; - int ret; + int irq_error, irq_event, ret; i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); if (!i2c_dev) @@ -1836,16 +1834,20 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) return PTR_ERR(i2c_dev->base); phy_addr = (dma_addr_t)res->start; - irq_event = irq_of_parse_and_map(np, 0); - if (!irq_event) { - dev_err(&pdev->dev, "IRQ event missing or invalid\n"); - return -EINVAL; + irq_event = platform_get_irq(pdev, 0); + if (irq_event <= 0) { + if (irq_event != -EPROBE_DEFER) + dev_err(&pdev->dev, "Failed to get IRQ event: %d\n", + irq_event); + return irq_event ? : -ENOENT; } - irq_error = irq_of_parse_and_map(np, 1); - if (!irq_error) { - dev_err(&pdev->dev, "IRQ error missing or invalid\n"); - return -EINVAL; + irq_error = platform_get_irq(pdev, 1); + if (irq_error <= 0) { + if (irq_error != -EPROBE_DEFER) + dev_err(&pdev->dev, "Failed to get IRQ error: %d\n", + irq_error); + return irq_error ? : -ENOENT; } i2c_dev->clk = devm_clk_get(&pdev->dev, NULL); -- 2.20.1