Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4E13C2BBCF for ; Wed, 16 Dec 2020 01:05:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CD1922DA9 for ; Wed, 16 Dec 2020 01:05:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CD1922DA9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 91D8489402; Wed, 16 Dec 2020 01:05:38 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id 00CF889402 for ; Wed, 16 Dec 2020 01:05:37 +0000 (UTC) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3AB61593; Wed, 16 Dec 2020 02:05:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1608080736; bh=KeT1RqKIWeu4js8OQg4pdb7dprmHzx6J581VbCa/7d0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tofgJF+w4zTDpwF08fnBidXXpea2M7fsqcWyUNbZGoY9hyr0Rzd+q3hwAQdXggM/i wGDx6/HVldofFCwWu1zpZAVenBM+aQQP30Tyylcz7AhRVVEsqYC0WxMMaCWy9HE5DV tyXeYMTxNHjiEwZ0PkbeiQtmOiHWUD1JbEyQzPHo= Date: Wed, 16 Dec 2020 03:05:29 +0200 From: Laurent Pinchart To: Wang Xiaojun Subject: Re: [PATCH] drm: rcar-du: Fix the return check of of_parse_phandle and of_find_device_by_node Message-ID: References: <20201111031452.3659714-1-wangxiaojun11@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-renesas-soc@vger.kernel.org, kieran.bingham+renesas@ideasonboard.com, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Dec 16, 2020 at 03:00:43AM +0200, Laurent Pinchart wrote: > Hi Wang, > > Thank you for the patch. > > On Wed, Nov 11, 2020 at 11:14:52AM +0800, Wang Xiaojun wrote: > > of_parse_phandle and of_find_device_by_node may return NULL > > which cannot be checked by IS_ERR. > > > > Signed-off-by: Wang Xiaojun > > Reported-by: Hulk Robot > > Reviewed-by: Laurent Pinchart > > and queued in my tree for v5.12. > > > --- > > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > index 72dda446355f..fcfddf7ad3f3 100644 > > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > @@ -700,10 +700,10 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu) > > int ret; > > > > cmm = of_parse_phandle(np, "renesas,cmms", i); > > - if (IS_ERR(cmm)) { > > + if (!cmm) { > > dev_err(rcdu->dev, > > "Failed to parse 'renesas,cmms' property\n"); > > - return PTR_ERR(cmm); > > + return -ENODEV; Actually, this should return -EINVAL, as this error really shouldn't happen. Same below. I'll update this, no need to resend a new version. > > } > > > > if (!of_device_is_available(cmm)) { > > @@ -713,10 +713,10 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu) > > } > > > > pdev = of_find_device_by_node(cmm); > > - if (IS_ERR(pdev)) { > > + if (!pdev) { > > dev_err(rcdu->dev, "No device found for CMM%u\n", i); > > of_node_put(cmm); > > - return PTR_ERR(pdev); > > + return -ENODEV; > > } > > > > of_node_put(cmm); -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel