From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 679D8C25B4F for ; Sun, 12 May 2024 21:20:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D270110E137; Sun, 12 May 2024 21:20:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RNNvYzjQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8AB810E137 for ; Sun, 12 May 2024 21:20:47 +0000 (UTC) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 95FD38BE; Sun, 12 May 2024 23:20:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1715548840; bh=IYYvknnK9tyMIPvkrRHEIHoGdP9l9/eZ68/Kr7wpv+0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RNNvYzjQXug1DRkE6BuFngaOZSHvkHanbsF/RB7Ls1Z7jDo2P+cijEs1UoyCEyU1C bqjd1aubB7jMFzvGOJXNC83LOWTJ5TdyHFHyJv+ebf7xwV7778smezW7F9yvhCLlHg rPAKhpwHPpHV/SJkd0jGtSVLObWWPBM7mijIsiM0= Date: Mon, 13 May 2024 00:20:38 +0300 From: Laurent Pinchart To: Sui Jingfeng Cc: Maxime Ripard , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/bridge: synopsys: dw-mipi-dsi: Remove a redundant check on existence of bridge->encoder Message-ID: <20240512212038.GR17158@pendragon.ideasonboard.com> References: <20240511144713.325156-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240511144713.325156-1-sui.jingfeng@linux.dev> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Sui, Thank you for the patch. On Sat, May 11, 2024 at 10:47:13PM +0800, Sui Jingfeng wrote: > In the dw_mipi_dsi_bridge_attach() function, the check on the existence > of bridge->encoder is not necessary, as it has already been done in the > drm_bridge_attach() function. And the check on the drm bridge core > happens before check in the implementation. Hence, it is guaranteed that > the .encoder member of the struct drm_bridge is not NULL when > dw_mipi_dsi_bridge_attach() function gets called. > > Remove the redundant checking codes "if (!bridge->encoder) { ... }". > > Signed-off-by: Sui Jingfeng Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index 824fb3c65742..c4e9d96933dc 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -1071,11 +1071,6 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge, > { > struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); > > - if (!bridge->encoder) { > - DRM_ERROR("Parent encoder object not found\n"); > - return -ENODEV; > - } > - > /* Set the encoder type as caller does not know it */ > bridge->encoder->encoder_type = DRM_MODE_ENCODER_DSI; > -- Regards, Laurent Pinchart