Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: linux-omap <linux-omap@vger.kernel.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	dri-devel@lists.freedesktop.org
Cc: sashiko-reviews@lists.linux.dev
Subject: Re: [PATCH] fbdev: omapfb: Fix __be32 sparse warning in panel_enabled()
Date: Sat, 22 Aug 2026 12:23:35 +0200	[thread overview]
Message-ID: <cd542bf5-775e-407f-88cc-4cf18305f2b3@gmx.de> (raw)
In-Reply-To: <20260822095809.1D0651F000E9@smtp.kernel.org>

CC'ing the linux-omap mailing list, in the hope someone with omap
knowledge can judge if the sashiko AI bot is right with his analysis that
acx565akm_transfer() might be wrong on big-endian systems?

On 8/22/26 11:58, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> 
> Pre-existing issues:
> - [High] Hardcoded little-endian assumption when transmitting the command byte breaks the driver on big-endian architectures.
> --
> 
> --- Patch [1]: [PATCH] fbdev: omapfb: Fix __be32 sparse warning in panel_enabled() ---
> commit a9e06be56fc1b74d7c6e76133e9ea1c25675a615
> Author: Helge Deller <deller@gmx.de>
> Subject: fbdev: omapfb: Fix __be32 sparse warning in panel_enabled()
> 
> This commit resolves a sparse warning in panel_enabled() by explicitly
> reading the display status into a __be32 variable. It then converts this
> value to CPU endianness using __be32_to_cpu() before checking the bits.
> 
> Closes: https://lore.kernel.org/oe-kbuild-all/202608211811.lps93xao-lkp@intel.com/
> 
>> diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c
>> index 8f430d9e80549..0202ca8cbfc23 100644
>> --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c
>> +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c
>> @@ -210,12 +210,13 @@ static void set_display_state(struct panel_drv_data *ddata, int enabled)
>>   
>>   static int panel_enabled(struct panel_drv_data *ddata)
>>   {
>> +	__be32 disp_status_be;
>>   	u32 disp_status;
>>   	int enabled;
>>   
>>   	acx565akm_read(ddata, MIPID_CMD_READ_DISP_STATUS,
>> -			(u8 *)&disp_status, 4);
> 
> [Severity: High]
> This is a pre-existing issue, but while looking at endianness fixes in this
> file, does acx565akm_transfer() have a similar issue on big-endian
> architectures?
> 
> When acx565akm_read() calls acx565akm_transfer(), it passes the command as
> an int:
> 
> drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c:acx565akm_transfer() {
>      ...
>      cmd &=  0xff;
>      x->tx_buf = &cmd;
>      x->bits_per_word = 9;
>      x->len = 2;
>      ...
> }
> 
> Because bits_per_word > 8, the SPI controller reads the buffer as a 16-bit
> integer. Taking the address of a 32-bit int on a little-endian system yields
> the command byte in the lowest bits. However, on big-endian systems, &cmd
> points to the most significant bytes (which are 0x00).
> 
> Will the SPI controller end up transmitting 0x0000 instead of the requested
> command on big-endian architectures?
> 
>> -	disp_status = __be32_to_cpu(disp_status);
>> +			(u8 *)&disp_status_be, 4);
>> +	disp_status = __be32_to_cpu(disp_status_be);
>>   	enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10));
>>   	dev_dbg(&ddata->spi->dev,
>>   		"LCD panel %senabled by bootloader (status 0x%04x)\n",
>>   		enabled ? "" : "not ", disp_status);
> 


       reply	other threads:[~2026-08-22 10:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260822094805.421002-1-deller@gmx.de>
     [not found] ` <20260822095809.1D0651F000E9@smtp.kernel.org>
2026-08-22 10:23   ` Helge Deller [this message]
2026-08-22 11:05     ` [PATCH] fbdev: omapfb: Fix __be32 sparse warning in panel_enabled() Andreas Kemnade

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=cd542bf5-775e-407f-88cc-4cf18305f2b3@gmx.de \
    --to=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.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