drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
The function drm_of_get_data_lanes_count_remote() returns negative error
codes and dsi->lanes is an unsigned integer, so the check (dsi->lanes <
0) is always impossible.
Detected by Smatch:
drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c:2959 jadard_dsi_probe()
warn: unsigned 'dsi->lanes' is never less than zero.
Fixes: eb019688f2a97 ("drm/panel: jadard-jd9365da-h3: support variable DSI configuration")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
index 7157b1299bfd..f6b04de1182e 100644
--- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
+++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
@@ -2955,9 +2955,11 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
dsi->format = desc->format;
dsi->lanes = desc->lanes;
if (!dsi->lanes) {
- dsi->lanes = drm_of_get_data_lanes_count_remote(dsi->dev.of_node, 0, -1, 2, 4);
- if (dsi->lanes < 0)
- return dsi->lanes;
+ ret = drm_of_get_data_lanes_count_remote(dsi->dev.of_node, 0, -1, 2, 4);
+ if (ret < 0)
+ return ret;
+ dsi->lanes = ret;
+
if (dsi->lanes == 4) {
if (!desc->mode_4ln) {
dev_err(&dsi->dev, "4-lane config is not supported\n");
--
2.54.0
Hi,
On Tue, 28 Apr 2026 21:49:54 -0500, Ethan Tidmore wrote:
> The function drm_of_get_data_lanes_count_remote() returns negative error
> codes and dsi->lanes is an unsigned integer, so the check (dsi->lanes <
> 0) is always impossible.
>
> Detected by Smatch:
> drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c:2959 jadard_dsi_probe()
> warn: unsigned 'dsi->lanes' is never less than zero.
>
> [...]
Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next)
[1/1] drm/panel: jadard-jd9365da-h3: Fix signedness bug
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/faddee87a933898139f5aa9e76bdca345936b538
--
Neil
On 4/29/26 04:49, Ethan Tidmore wrote:
> The function drm_of_get_data_lanes_count_remote() returns negative error
> codes and dsi->lanes is an unsigned integer, so the check (dsi->lanes <
> 0) is always impossible.
>
> Detected by Smatch:
> drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c:2959 jadard_dsi_probe()
> warn: unsigned 'dsi->lanes' is never less than zero.
>
> Fixes: eb019688f2a97 ("drm/panel: jadard-jd9365da-h3: support variable DSI configuration")
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
> drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> index 7157b1299bfd..f6b04de1182e 100644
> --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> @@ -2955,9 +2955,11 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
> dsi->format = desc->format;
> dsi->lanes = desc->lanes;
> if (!dsi->lanes) {
> - dsi->lanes = drm_of_get_data_lanes_count_remote(dsi->dev.of_node, 0, -1, 2, 4);
> - if (dsi->lanes < 0)
> - return dsi->lanes;
> + ret = drm_of_get_data_lanes_count_remote(dsi->dev.of_node, 0, -1, 2, 4);
> + if (ret < 0)
> + return ret;
> + dsi->lanes = ret;
> +
> if (dsi->lanes == 4) {
> if (!desc->mode_4ln) {
> dev_err(&dsi->dev, "4-lane config is not supported\n");
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
© 2016 - 2026 Red Hat, Inc.