Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1040598imj; Thu, 7 Feb 2019 16:31:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IYQnGKMGq9xEW6/igdce9jXqG8aZVb8250FkPKX1e5WGgd7/h1qz49zjcP8rww69YmqHo5B X-Received: by 2002:a17:902:bcc7:: with SMTP id o7mr19844989pls.281.1549585910821; Thu, 07 Feb 2019 16:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549585910; cv=none; d=google.com; s=arc-20160816; b=vkU30XtbV3wG5bJX4038f6sIEBAubnbvZRPGZ3UEnwxD0wEgVk4Tl7W/52GuZ4V+aj nzao8YOquC/7xOvOH7Tq6U5QAlRWC2L+yC8uDYsGYb2KR1ejubzvTJowR1W+b4e7KqQK ZPc5cYuSTjLg1eAF4gcfjIOwYMdljr89Se9n0fi85xjBpwvcNo4XZu4Xdlv76/LGbUd2 WUvZZ95/Un8Meje7RPAFDeb9Hbo0K7dWLEzb+srta2xTbxVce0p+ZMlKsREdgUOqBHvl 2wKIzk4Q1P531UamPtAak8WU6bhafbDpLFR7WUbrYU5QowJgxB/z69oKjkwPQEIcWmiZ EvLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=7S52tSANvStNoXW0WQ36+UsE+KrxcVitS5RILjsG2Rs=; b=A7CAlOhQVxtHPOvskGm81gzf3XrxYnin+Lb8POLuYPMtiaNWOn9Nl23k60moPYLx3f JIOn9Q2NhWVXYmleFz7SlUHIJGdeZTm6OnwZCAwBuhdsy0DKB7zoJAGKGD0cCwUtfR/Y 1VU5LNctpP6P6aNVey2HU7yB+3+li8L37W5R+g3WdDcqRP6i46xg42qmISfOgVe2PE2m IunHr5+UPdSCPqQrGLZ8vwoOvqa6CUWSYWhBIJnNwkqnsz8TjZvl4/Y9+vbsRnQEcbz4 9XaM/MssRWmxXlipDknxjmO0Oh33bXHlHS0K4Q+jdl5N7QWqq+NeJtrcu1JFTqMqQ8Ez cPCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=wxLlntPq; 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 bg9si483598plb.317.2019.02.07.16.31.35; Thu, 07 Feb 2019 16:31:50 -0800 (PST) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=wxLlntPq; 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 S1727124AbfBHAaf (ORCPT + 99 others); Thu, 7 Feb 2019 19:30:35 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37111 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbfBHAaf (ORCPT ); Thu, 7 Feb 2019 19:30:35 -0500 Received: by mail-pf1-f194.google.com with SMTP id y126so823286pfb.4 for ; Thu, 07 Feb 2019 16:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=7S52tSANvStNoXW0WQ36+UsE+KrxcVitS5RILjsG2Rs=; b=wxLlntPqF3hw5HcVUT4Uo8fC0zp8kVBeWdsXIK8VgDh0wHsBNx1SL+W2ZcrFugtQwj 34dEwKPa5aGl7JeQz4Zr3e1KeeQoKS4PsdyRxPa5F1b6fFW3hez99X9GftDbqDO44udW EeN13mmEb6/rplIGjSCTMzdFOS7McaHduPfgKOW0r4zY1Oc+RVaFHgCVUnhJCl9XjErQ UAZw2LoS9xN1z7U/RcQKb4DJDWo/BITDoELtwXbnvwOBfqKDA7rJ46FL8OG6IZ8BOPlh g8iV1j2Bmqhn6FznMKS1Xe4unyYrVF+6gAnvT7GRTsbkV0nOUAB2dphhEjAp0+7w3fPu T8lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=7S52tSANvStNoXW0WQ36+UsE+KrxcVitS5RILjsG2Rs=; b=ZCc2SgmZ6gf4l93Zfto1htetpYilF6R7fpUgE1YYzHl/1rQrvoZFDKtyQL14yn8vX5 isaaCckhDMI0UQCv7FMm0NsI05H1QWDP7Ylku97QhT84frbNHtkd4KRMvRd9CE5pIo80 imROGPvPZYF5q+ii1p3MmSHuw1enApuxiaPO6+keWjJ+J3AptYEn10UHjFGNtgDdlye0 gjqgXT63pAV0aAlZDvJOlHRo8F1PDGWw5Cti8yW71VnTWdZStQAES+o0t/oqlTVAZsZ5 1CTsJpGyc1vIzJinzbUVGXdtv+AyzXECGRxkF5qy0ell8Y1LDKYEjaXqiKhK+2WSR6sH FfMw== X-Gm-Message-State: AHQUAuZD0EPQ8sDRkLyCNOYv7KuxiY0wvty2pAUWcURgPRRbASmQUkM2 1x5FcR9hSOyijOX9L1KsDBR2lA== X-Received: by 2002:a63:2c8c:: with SMTP id s134mr16359331pgs.269.1549585833487; Thu, 07 Feb 2019 16:30:33 -0800 (PST) Received: from localhost ([2601:602:9200:a1a5:1818:ce94:f47:7c12]) by smtp.googlemail.com with ESMTPSA id a13sm321291pgq.65.2019.02.07.16.30.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 16:30:32 -0800 (PST) From: Kevin Hilman To: Maxime Jourdan , Neil Armstrong Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] soc: amlogic: canvas: Fix meson_canvas_get when probe failed In-Reply-To: References: <20190204094937.22763-1-narmstrong@baylibre.com> Date: Thu, 07 Feb 2019 16:30:31 -0800 Message-ID: <7h4l9fglzs.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Maxime Jourdan writes: > On Mon, Feb 4, 2019 at 10:49 AM Neil Armstrong wrote: >> >> When probe fails, a platforn_device is still associated to the node, >> but dev_get_drvdata() returns NULL. >> >> Handle this case by returning a consistent error. >> >> Fixes: d4983983d987 ("soc: amlogic: add meson-canvas driver") >> Signed-off-by: Neil Armstrong >> --- >> drivers/soc/amlogic/meson-canvas.c | 13 ++++++++++++- >> 1 file changed, 12 insertions(+), 1 deletion(-) >> >> This fix depends on "soc: amlogic: add missing of_node_put()" at [1] >> >> [1] https://patchwork.kernel.org/patch/10794545/ >> >> diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c >> index 87a6c6e23591..151aa84bc593 100644 >> --- a/drivers/soc/amlogic/meson-canvas.c >> +++ b/drivers/soc/amlogic/meson-canvas.c >> @@ -51,6 +51,7 @@ struct meson_canvas *meson_canvas_get(struct device *dev) >> { >> struct device_node *canvas_node; >> struct platform_device *canvas_pdev; >> + struct meson_canvas *canvas; >> >> canvas_node = of_parse_phandle(dev->of_node, "amlogic,canvas", 0); >> if (!canvas_node) >> @@ -63,7 +64,17 @@ struct meson_canvas *meson_canvas_get(struct device *dev) >> } >> >> of_node_put(canvas_node); >> - return dev_get_drvdata(&canvas_pdev->dev); >> + >> + /* >> + * If priv is NULL, it's probably because the canvas hasn't >> + * properly initialized. Bait out with -EINVAL because, in the > > Bait -> Bail ? Fixed this up locally. [...] > Thanks for the patch, I missed the fact that a driver could have a > pdev yet with a failed probe. > > Reviewed-by: Maxime Jourdan Queud for v5.1 with Maxime's tag. (branch: v5.1/drivers) Kevin