From patchwork Mon May 13 15:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13663542 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (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 454A9156863 for ; Mon, 13 May 2024 15:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715614322; cv=none; b=c4Lu6/ALbpgyC/OJ+g8sew2o+4/ZFFJcJYNT2ku0Hfrzg/oB1xHdq+m9f5rqu8edTmoM/GMOZk0yutqKFsz95K0woNE3c0APHQX7AgmsTojlDF+4d5izM4r56nJlr2lNDhxnqopnxwjx1hZ4fBf08MK59OpZjEDZcSl8Hi/IRHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715614322; c=relaxed/simple; bh=+RwW506SglCqz4XSZa/oNMNKUKVLp9KPIi06iPs5tuE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XaXSXa/8e2kl4rhU8ovxFXr/Ey95OPGHo57c1f5KXNMatk+4UdnF9DVEDE24OLTzbnyTsoE13086VNedu0FV4pvHo58AdkoTjLRH25PVW1+V0iv6py4Kg+rT/cmE1pvrgkdpsRtVwXfyojMrufKJCPWkKUUCRb+afsvoMiJV3eM= 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=nhcZDRYN; arc=none smtp.client-ip=95.215.58.170 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="nhcZDRYN" 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=1715614318; 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=J5+V1S9388YXGse4Sl78OBq2S/qOMf7C/8WKdb7RqiQ=; b=nhcZDRYN54cD/TsvPcSD91AHbbllmZLhrQztxz4D3HC29SFhukyJHM4ObtTd2TA6d0n4jg 7CTKFvBjuPxckIOdORe8mBHDJFRR8+yjhwa5Fu40wh7QZBnGn60j4aZNoGYDGl1ZPPDXEK 0p1FrwK/5A7PS0MyRv30nx/3Hk8ss0g= 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 12/12] drm/bridge: analogix: Remove redundant checks on existence of bridge->encoder Date: Mon, 13 May 2024 23:31:09 +0800 Message-ID: <20240513153109.46786-13-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 The checks on the existence of bridge->encoder in the implementation of drm_bridge_funcs::attach() is not necessary, as it has already been checked in the drm_bridge_attach() function call by previous bridge or KMS driver. The 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 various bridge attach functions are called. Remove the redundant checking codes "if (!bridge->encoder) { ... }". Reviewed-by: Laurent Pinchart Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 5 ----- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 5 ----- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 ----- drivers/gpu/drm/bridge/analogix/anx7625.c | 10 ---------- 4 files changed, 25 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c index c9e35731e6a1..cfe43d2ca3be 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c @@ -528,11 +528,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, return -EINVAL; } - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - /* Register aux channel */ anx6345->aux.name = "DP-AUX"; anx6345->aux.dev = &anx6345->client->dev; diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c index 5748a8581af4..58875dde496f 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c @@ -897,11 +897,6 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge, return -EINVAL; } - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - /* Register aux channel */ anx78xx->aux.name = "DP-AUX"; anx78xx->aux.dev = &anx78xx->client->dev; diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index df9370e0ff23..7b841232321f 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1228,11 +1228,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge, return -EINVAL; } - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - if (!dp->plat_data->skip_connector) { connector = &dp->connector; connector->polled = DRM_CONNECTOR_POLL_HPD; diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 59e9ad349969..3d09efa4199c 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2193,11 +2193,6 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge, if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) return -EINVAL; - if (!bridge->encoder) { - DRM_DEV_ERROR(dev, "Parent encoder object not found"); - return -ENODEV; - } - ctx->aux.drm_dev = bridge->dev; err = drm_dp_aux_register(&ctx->aux); if (err) { @@ -2435,11 +2430,6 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge, dev_dbg(dev, "drm atomic enable\n"); - if (!bridge->encoder) { - dev_err(dev, "Parent encoder object not found"); - return; - } - connector = drm_atomic_get_new_connector_for_encoder(state->base.state, bridge->encoder); if (!connector)