From patchwork Mon May 13 15:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13663531 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB044153589 for ; Mon, 13 May 2024 15:31:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715614286; cv=none; b=SUbfrOIX6xSHhyyEKiuFZYWyLmkjaBsbwSd+YzIuDe7UHVmFZsJZBc0plZOv1ZeNDpzLg2TVyNaJZss0Odd2E/ZR3MASD/3DyY5KS9UK1VmkrDx4MkE/QCMZc+CkjVYRhSCsTgncsmhCX8EjbQ8LlFIeLgSFVGFs4r9FRf1zcYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715614286; c=relaxed/simple; bh=l89qcY05vZBXoEEEwzVwYsUrgne6mG0qP39cHxCZ9YY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DTbPOVWgLBxR83ZDhgyUaVvfU60XEXLPQu8ihybLuQJ1qzkV2IIXHui6veoyLGtR3/9TvoEa2ttfhP5ybGdaZ+tj/pXAIi8p3D+nyR6Oov7yZ4ZEr4Gg7EVxPlEU7rS+oY7sC20IzYDf+FV6e53jrjT+pNOamxeIB5oG1oZlwAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=xv2NJ8oB; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="xv2NJ8oB" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715614282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WiifdoFYgTp3rVEK2qqeyz0G8r+zsR9iFqUJx/OeTgY=; b=xv2NJ8oBRndXa8ykHGEtOp3Az38+Qtnmuim843TUjh1gWieTYWz6a7OMJGYlc8wi2pYIv+ Cssj7AOECrLYKW8tryoychMlunWVtWmb/Gk5UrnSjOGQMlLDcmUjgvKF5/dAfOFKyP3GN3 sXGdeBCJWv2VOdSAh5ARWgXx27CFts8= From: Sui Jingfeng To: Laurent Pinchart Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Sascha Hauer , Douglas Anderson , Maxime Ripard , Thomas Zimmermann , Liu Ying , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Sui Jingfeng , Laurent Pinchart Subject: [PATCH v2 01/12] drm/bridge: simple-bridge: Remove a redundant check on existence of bridge->encoder Date: Mon, 13 May 2024 23:30:58 +0800 Message-ID: <20240513153109.46786-2-sui.jingfeng@linux.dev> In-Reply-To: <20240513153109.46786-1-sui.jingfeng@linux.dev> References: <20240513153109.46786-1-sui.jingfeng@linux.dev> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Because the existence of 'bridge->encoder' has already been checked before the simple_bridge_attach() function get called, and drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when the simple_bridge_attach() get called. Remove the redundant checking codes "if (!bridge->encoder) { ... }". Reviewed-by: Laurent Pinchart Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/simple-bridge.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c index 5813a2c4fc5e..2ca89f313cd1 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -116,11 +116,6 @@ static int simple_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(&sbridge->connector, &simple_bridge_con_helper_funcs); ret = drm_connector_init_with_ddc(bridge->dev, &sbridge->connector,