From: Ian Rogers <irogers@google.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: Guodong Xu <guodong.xu@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, Elkin Cruz <elkin@google.com>,
Ian Rogers <irogers@google.com>
Subject: [PATCH v2] drm/msm/dp: Return MODE_ERROR in dp_display and drop dead eDP check
Date: Tue, 1 Dec 2026 09:42:06 -0800 [thread overview]
Message-ID: <20261201174206.1431879-1-irogers@google.com> (raw)
msm_dp_display_mode_valid() and msm_edp_bridge_mode_valid() return
enum drm_mode_status, yet both returned -EINVAL (-22) on an invalid
parameter check for !dp || !mode_pclk_khz || !dp->connector.
Today neither check can trigger because drm_mode_validate_basic()
rejects mode->clock == 0 before bridge .mode_valid() runs, and dp and
dp->connector are initialized before mode validation. Keep the guard in
the shared msm_dp_display_mode_valid() helper but return MODE_ERROR
instead of -EINVAL, and drop the unreachable check from the static
msm_edp_bridge_mode_valid() callback.
Found with Clang's -Wassign-enum on an x86_64 allyesconfig build; Gemini
helped analyze the callers and prepare the patch and commit message.
Compile-tested on dp_display.o and dp_drm.o with LLVM=1 W=1 (-Werror)
and -Wassign-enum; not runtime-tested because Qualcomm Snapdragon
DP/eDP hardware is not available.
Signed-off-by: Ian Rogers <irogers@google.com>
---
Notes:
v2:
- Return MODE_ERROR instead of MODE_BAD in msm_dp_display_mode_valid()
to match the "invalid params" error (Guodong Xu).
- Drop the dead if (!dp || !mode_pclk_khz || !dp->connector) check in
the static msm_edp_bridge_mode_valid() callback and drop Fixes tags
since the checks are currently unreachable (Guodong Xu).
v1: https://lore.kernel.org/r/20261119171046.1536673-1-irogers@google.com
drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
drivers/gpu/drm/msm/dp/dp_drm.c | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index c0c150e2c575..e01a43b17ca3 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -759,7 +759,7 @@ enum drm_mode_status msm_dp_display_mode_valid(struct msm_dp *dp,
if (!dp || !mode_pclk_khz || !dp->connector) {
DRM_ERROR("invalid params\n");
- return -EINVAL;
+ return MODE_ERROR;
}
msm_dp_display = container_of(dp, struct msm_dp_display_private, msm_dp_display);
diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
index c1e4147bfef1..c21e2bf4f22c 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.c
+++ b/drivers/gpu/drm/msm/dp/dp_drm.c
@@ -249,11 +249,6 @@ static enum drm_mode_status msm_edp_bridge_mode_valid(struct drm_bridge *bridge,
dp = to_dp_bridge(bridge)->msm_dp_display;
- if (!dp || !mode_pclk_khz || !dp->connector) {
- DRM_ERROR("invalid params\n");
- return -EINVAL;
- }
-
if (msm_dp_wide_bus_available(dp))
mode_pclk_khz /= 2;
--
2.56.1.839.g22a8290db9-goog
reply other threads:[~2026-12-01 17:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201174206.1431879-1-irogers@google.com \
--to=irogers@google.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=elkin@google.com \
--cc=freedreno@lists.freedesktop.org \
--cc=guodong.xu@oss.qualcomm.com \
--cc=jesszhan0024@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®