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 8A648C25B4F for ; Sun, 12 May 2024 21:14:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4F3110E0AD; Sun, 12 May 2024 21:14:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OVf1pBUr"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABDB610E0AD for ; Sun, 12 May 2024 21:14:34 +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 9C6D38BE; Sun, 12 May 2024 23:14:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1715548467; bh=FG6iKX2wYIDzAZO1I+hGEmxBg8st+4S4h3rD+0EIdPM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OVf1pBUrQ3+ReIvEpXYckwu1PKGSeSbmzPcp8TgSMlMRqZyrqyT4t7PDTX8bx8+Bj O5wneKOyBWUey0VJV5wTZMi1HEdsToGMSwbq1rng8Q4NmT8F/R3SrMqmea+Q75w2ww gw6+tHULeVflFJl8VHtc8VB4gfsSxiJmlRzdLg5g= Date: Mon, 13 May 2024 00:14:25 +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: panel: Remove a redundant check on existence of bridge->encoder Message-ID: <20240512211425.GL17158@pendragon.ideasonboard.com> References: <20240511140316.318080-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240511140316.318080-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:03:16PM +0800, Sui Jingfeng wrote: > In panel_bridge_attach(), the check on the existence of bridge->encoder > has already been done in the implementation of drm_bridge_attach(). And > it is done before the bridge->funcs->attach hook is called. Hence, it is > guaranteed that the .encoder member of the struct drm_bridge is not NULL > when the panel_bridge_attach() is called. > > There is no need to check the existence of bridge->encoder another time > at the implementation layer, therefore remove the redundant checking codes > "if (!bridge->encoder) { ... }". > > Signed-off-by: Sui Jingfeng Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/bridge/panel.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c > index 7f41525f7a6e..762402dca6dd 100644 > --- a/drivers/gpu/drm/bridge/panel.c > +++ b/drivers/gpu/drm/bridge/panel.c > @@ -65,11 +65,6 @@ static int panel_bridge_attach(struct drm_bridge *bridge, > if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) > return 0; > > - if (!bridge->encoder) { > - DRM_ERROR("Missing encoder\n"); > - return -ENODEV; > - } > - > drm_connector_helper_add(connector, > &panel_bridge_connector_helper_funcs); > -- Regards, Laurent Pinchart