]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: phytec: phytec_som_detection: Add missing assignment
authorDaniel Schultz <d.schultz@phytec.de>
Mon, 24 Nov 2025 08:25:05 +0000 (00:25 -0800)
committerTom Rini <trini@konsulko.com>
Sun, 7 Dec 2025 14:07:07 +0000 (08:07 -0600)
Assign the return value of snprintf (total length) to a variable to
properly check if the string has the correct length.

Currently, this variable is always zero and the length check after
snprintf will always fail.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
board/phytec/common/phytec_som_detection.c

index 136f4486eb0e5a7b3d783b80cea4f602cddbdd24..ff1711c24b499f57482effbd45417f91c75da98b 100644 (file)
@@ -346,8 +346,8 @@ static int phytec_get_part_number(struct phytec_eeprom_data *data,
                return 0;
        }
        if (api2->som_type <= 3) {
-               snprintf(part, PHYTEC_PART_NUMBER_MAX_LEN + 1, "%s.%s",
-                        product_name, api2->bom_rev);
+               len = snprintf(part, PHYTEC_PART_NUMBER_MAX_LEN + 1, "%s.%s",
+                              product_name, api2->bom_rev);
                if (len != PHYTEC_PART_NUMBER_KSP_LEN)
                        return -EINVAL;
                return 0;