Devicetree
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/3] drm/panel: ilitek-ili9881c: Add support for two-lane configuration
Date: Fri, 4 Dec 2026 19:05:33 +0100	[thread overview]
Message-ID: <b65860c0-321a-4834-a0a4-9054f061120c@bootlin.com> (raw)
In-Reply-To: <sashiko-outbox-250316@kernel.org>



On 12/4/26 18:28, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [High] drm/panel: ilitek-ili9881c: ili9881c_dsi_probe() attaches with
>    0 lanes
> - [Low] drm/panel: ilitek-ili9881c: missing newlines in
>    ili9881c_dsi_probe() logs
> --
> 
> commit e899140e568f50f7b97bce08c9f86acfc451c3c2
> Author: Kory Maincent <kory.maincent@bootlin.com>
> 
> drm/panel: ilitek-ili9881c: Add support for two-lane configuration
> 
> This commit adds support for two-lane configuration in the ILI9881c panel
> driver and reads the lane count from the remote DSI endpoint when the panel
> descriptor omits it.
> 
>> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
>> index 0854c4cf7ebd7..a858830c9f520 100644
>> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
>> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
> 
> [ ... ]
> 
>> @@ -3012,13 +3024,22 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
>>   	if (ret)
>>   		return ret;
>>   
>> -	ret = devm_drm_panel_add(&dsi->dev, &ctx->panel);
>> -	if (ret)
>> -		return ret;
>> -
>>   	dsi->mode_flags = ctx->desc->mode_flags;
>>   	dsi->format = MIPI_DSI_FMT_RGB888;
>>   	dsi->lanes = ctx->desc->lanes;
>> +	if (!dsi->lanes) {
>> +		ret = drm_of_get_data_lanes_count_remote(dsi->dev.of_node, 0, -1, 2, 4);
>> +		if (ret < 0)
>> +			dev_info(&dsi->dev, "No lanes number described");
>> +		else if (ret != 2 && ret != 4)
>> +			dev_warn(&dsi->dev, "Wrong lanes number");
> 
> [Severity: Low]
> Both dev_info() and dev_warn() strings are missing a trailing '\n', unlike
> the other log messages in this driver.

Oops indeed.

>> +		else
>> +			dsi->lanes = ret;
>> +	}
>> +
>> +	ret = devm_drm_panel_add(&dsi->dev, &ctx->panel);
>> +	if (ret)
>> +		return ret;
>>   
>>   	return devm_mipi_dsi_attach(&dsi->dev, dsi);
>>   }
> 
> [Severity: High]
> Can this call devm_mipi_dsi_attach() with dsi->lanes set to 0?
>
> When ctx->desc->lanes is 0 and the remote endpoint omits data-lanes or
> specifies an unsupported count such as 3, ili9881c_dsi_probe() logs a
> message and falls through without setting dsi->lanes or returning an error.
> 
> DSI host drivers assume device->lanes >= 1: vc4_dsi_host_attach() divides
> by dsi->lanes directly, causing a divide-by-zero oops during attach, and
> dw_mipi_dsi_get_minimum_lbcc() indexes minimum_lbccs[dsi->lanes - 1],
> causing an out-of-bounds read.
> 
> Also, drm_of_get_data_lanes_count_remote() returns -EINVAL for out-of-range
> counts as well as missing properties, so the ret < 0 branch misreports
> invalid lane counts as missing.  Returning an error on both failure
> branches, as jadard_dsi_probe() does, avoids attaching with zero lanes.

I can't do that, because this will broke panel like the kd050hdfia020 
which have no lanes number described in the descriptor and maybe no 
data-lanes devicetree parameter.

-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


  reply	other threads:[~2026-12-04 18:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 17:14 [PATCH v3 0/3] Add support for Saef SFTO340XC panel Kory Maincent
2026-12-04 17:14 ` [PATCH v3 1/3] dt-bindings: ili9881c: Add Saef SFTO340XC support Kory Maincent
2026-12-04 17:14 ` [PATCH v3 2/3] drm/panel: ilitek-ili9881c: Add support for two-lane configuration Kory Maincent
2026-12-04 17:28   ` sashiko-bot
2026-12-04 18:05     ` Kory Maincent [this message]
2026-12-04 17:14 ` [PATCH v3 3/3] drm/panel: ilitek-ili9881c: Add Saef SFTO340XC LCD panel Kory Maincent
2026-12-04 17:25   ` sashiko-bot
2026-12-04 17:52     ` Kory Maincent

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=b65860c0-321a-4834-a0a4-9054f061120c@bootlin.com \
    --to=kory.maincent@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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