Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3793258ybi; Mon, 29 Jul 2019 12:44:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTLwzJuZcwYQZa754iEyUVXHixyuAEzcf29n+KJ7UyD36QauDZ+viLfQtI7Ztu0kYvkSpm X-Received: by 2002:a65:55c7:: with SMTP id k7mr75071367pgs.305.1564429462049; Mon, 29 Jul 2019 12:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429462; cv=none; d=google.com; s=arc-20160816; b=DFQuqfDwqbc6AyGtDtAtC/BlTXPq0XIOayPdYb95ZJRczIGgCyQcmtG/gi/M9mxTMS 1v7tu+WYRH8+L3bMBVCeBpd8hxL10GZLI5lzm5bYCuTw5eC6sX1G7SeWBBxDm2EwQpfQ u/rU0vNZxvepm8n+BsNp7NjdayhuTnDo4lQcyFXN7nVKg6yeb3VY723WIY3zsQxC/TOu EnN9OsD8CA/7QFa9Zngwh1UCY6Ol4mJrQradNxvSMJNp0CnXxVwvJJ4IO+CX68j9UYYv ekSBC+7hZGokngd7zv6j8aUjf7PolsvzeVFXqMNvfWA8kJvw+ZMeTtkJD0S+vuKDbt1H JIVw== 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=zq68R5W93SXHQCw8Tsjb76pQsdBdfFdD/Wj1PDOk/gk=; b=ZqX26Imjw/weP4FSLL8U1eK4YeepPWeIHsz5b4g6xCmsi+jIKBdQ+2Dvyj6jDEIoMY O1cE7NU7625VzU8qRkTn9lel7/YzzG3M71VvWuPM3z5R3zehSZyNkSoYsPUjEKvVeIV2 Pjb1pCxf81NITKAaIz3NPb7WBrm1j9TfiqQJcNaymTiTHNqWDaTEhmnq8FNz6xTDVoQc 7MwbuznBKt3whkDbMDD3SoCZ8M+gQETVTQGHWlEgzInCAgQIMcg3eyTBp+uGWtV9JeVo QBjzJRacSuEKhnpDYIA8WgSGsq1Lit2PN/LzlbkkyYyf2KPDhZVRAAuFz4fXONXfcxg5 hkYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KdP1JcPS; 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 z12si20813580pfc.99.2019.07.29.12.44.07; Mon, 29 Jul 2019 12:44:22 -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=KdP1JcPS; 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 S2389573AbfG2TnA (ORCPT + 99 others); Mon, 29 Jul 2019 15:43:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389125AbfG2Tm7 (ORCPT ); Mon, 29 Jul 2019 15:42:59 -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 B83CE21655; Mon, 29 Jul 2019 19:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429378; bh=Fqr3Y2KSdCliua66hqqup3p0TkuZZx+Pestb7gIWH9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KdP1JcPSMW+x9bdFosIlA3NYBlJu6JI2Px6fQzKS1jmrELsPd3IWz7PffsmObS3or TgdZ6xKB1n89W8wMHPTeUAxZ6VsB6elUmpZmVIxO/YX/W8elXpzfZhcgs5m29BEhpV THKia0x5LlVFr8jwN/Gg5BeSvjiQfmEY5iDJpSkE= 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 4.19 040/113] i2c: stm32f7: fix the get_irq error cases Date: Mon, 29 Jul 2019 21:22:07 +0200 Message-Id: <20190729190705.318915282@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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 a492da9fd0d3..ac9c9486b834 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -1782,15 +1781,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) @@ -1802,16 +1800,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