]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
common: spl: spl_dfu.c: Fix warning associated with PCI subclass_code
authorSiddharth Vadapalli <s-vadapalli@ti.com>
Thu, 5 Mar 2026 10:38:14 +0000 (16:08 +0530)
committerMattijs Korpershoek <mkorpershoek@kernel.org>
Thu, 12 Mar 2026 08:59:33 +0000 (09:59 +0100)
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
subclass_code.

Fixes: cde77583cf0b ("spl: Add support for Device Firmware Upgrade (DFU) over PCIe")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Tested-by: Anshul Dalal <anshuld@ti.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org> # am62x_evm_a53
Link: https://lore.kernel.org/r/20260305103815.999886-1-s-vadapalli@ti.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
common/spl/spl_dfu.c

index b09f82790c99923b2614c4b95e17e30ea689edc7..7d21bb4d16ac4ed629d9c091322973daf0a00bc5 100644 (file)
@@ -64,7 +64,7 @@ static int dfu_over_pcie(void)
        hdr.deviceid = CONFIG_SPL_PCI_DFU_DEVICE_ID;
        hdr.vendorid = CONFIG_SPL_PCI_DFU_VENDOR_ID;
        hdr.baseclass_code = PCI_BASE_CLASS_MEMORY;
-       hdr.subclass_code = PCI_CLASS_MEMORY_RAM;
+       hdr.subclass_code = PCI_CLASS_MEMORY_RAM & 0xff;
 
        ret = pci_ep_write_header(dev, fn, &hdr);
        if (ret) {