Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3132124ybi; Thu, 18 Jul 2019 21:39:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfpBn1BfLoIimT4YgyeUiJHZcUtHPQn5fjZt2TXS4yNsbUeRDGO+JQMtEzC39xY+5Y+53d X-Received: by 2002:a17:902:ab8f:: with SMTP id f15mr53805243plr.159.1563511167758; Thu, 18 Jul 2019 21:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563511167; cv=none; d=google.com; s=arc-20160816; b=RL0v2BLqtN47Ep6ysgLux/Av3/4Gx/ZYCauHq1ugAvy+n3k1cJzBGqsqfLPCRALMsD bgMPEk03egiY/a9K7whVfqHeOpIujCSd3pxSL40WatEed5ZcwSXuVOsmAMuQAR6QsCOM K3W3Eb3bV3qw4fjTuIsBhF9cqD2mnEvvwmQDeiwhrEnt9J2errVCujXg/4Eai7zOx5Nb 7IYMLJVjJEBCnTFFyP2vCwmLGP+75annDpcGy+Dzlpp1Y+rFTvzK0uIZJe5xfG7q8Q1Y Ng4V3QX0jWEPKZnfJx4ss5R+8ESuBzxP0iqq3HsyyxGmZY48WUWz0OUat7otXMP4t6Dq zj1g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q8JfHTW9fv7urj5tF9ReD10RnkFTbIn+6oI6cSLrkwU=; b=I5I+eR8tof83BSNdEOlMbQ+OyKWLCjQSaJp249lbbZFzQJCwkgFLXjRVLVL8QgyGHQ hKWWFo1EWNcS+elqM/PzkQvBHYFxsGjLWeVr1WcmCvlFmkQ98c8DpfkkFCWjA/BkVUAk Xen7JdSSuh6/ojk/po3GLN1UK7fKsRgEhPXyGXsgzD5X2i4lAUHL7F0dNOsXBGHzAd+Z ajAH/+HYc30Xe3bU4EIEt7RtfWKl6wJI04ZFgFnOXOmFOPxfqjfnHGGflluj/sf3xI1b vp82uwZYHgB7XsFMXaYwDhJxwD+y4Ifgs0DoIU/QVJ4DjtqNfJDZl1hlbx2C0LHjcgF6 VIJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vopHwHRn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c76si4431178pfb.208.2019.07.18.21.39.12; Thu, 18 Jul 2019 21:39:27 -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=vopHwHRn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389462AbfGSEiA (ORCPT + 99 others); Fri, 19 Jul 2019 00:38:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728773AbfGSD7f (ORCPT ); Thu, 18 Jul 2019 23:59:35 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC1CE21897; Fri, 19 Jul 2019 03:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508774; bh=rQu1fthOwE3GJJSjLt530Jq0TgMDWOzmND3gXPhaF7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vopHwHRnrjJaObKmLNTHAV+oTykLinlFdOEW5n6bWxJUWe77Ok1Hd1Eu8J87i1DlA N8XuLddUCJAzi6gttgkp7q8jZ0PxrK8RAF9QRWhfyWE3BOr/gwU746JEUaHE2NtR/J lmmlMYdctoOFxFXJPkuBOqWMh7F2iUZOCB0BYFCo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fabrice Gasnier , Pierre-Yves MORDRET , Fabien Dessenne , Wolfram Sang , Sasha Levin , linux-i2c@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 083/171] i2c: stm32f7: fix the get_irq error cases Date: Thu, 18 Jul 2019 23:55:14 -0400 Message-Id: <20190719035643.14300-83-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabrice Gasnier [ 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