[PATCH] common: spl: spl_dfu.c: Fix warning associated with PCI subclass_code

Siddharth Vadapalli s-vadapalli at ti.com
Thu Mar 5 15:54:31 CET 2026


On 05/03/26 6:38 PM, Mattijs Korpershoek wrote:
> Hi Siddharth,
> 
> Thank you for the patch.
> 
> On Thu, Mar 05, 2026 at 16:08, Siddharth Vadapalli <s-vadapalli at ti.com> wrote:
> 
>> The subclass_code member of the pci_ep_header structure is a 1-byte
>> field. The macro PCI_CLASS_MEMORY_RAM is a concetation of baseclass_code
>> and subclass_code as follows:
>> 	PCI_BASE_CLASS_MEMORY: 0x05
>> 	Subclass Code for RAM: 0x00
>> 	PCI_CLASS_MEMORY_RAM:  0x0500
>> Hence, instead of extracting it via an implicity type conversion from int
>> to u8 which throws a warning, explicitly mask the bits to extract the
> 
> What's the exact warning string? With which compiler version?

u-boot/common/spl/spl_dfu.c: In function ‘dfu_over_pcie’:
u-boot/include/pci_ids.h:48:41: warning: unsigned conversion from ‘int’ 
to ‘u8’ {aka ‘unsigned char’} changes value from ‘1280’ to ‘0’ [-Woverflow]
    48 | #define PCI_CLASS_MEMORY_RAM            0x0500
       |                                         ^~~~~~
u-boot/common/spl/spl_dfu.c:67:29: note: in expansion of macro 
‘PCI_CLASS_MEMORY_RAM’
    67 |         hdr.subclass_code = PCI_CLASS_MEMORY_RAM;
       |                             ^~~~~~~~~~~~~~~~~~~~

> 
> Is there an example defconfig that I can use to reproduce this?

CONFIG_SPL_PCI_DFU needs to be enabled for the warning to be displayed 
and will be seen in the context of PCIe Boot.

Regards,
Siddharth.


More information about the U-Boot mailing list