[PATCH v6 2/2] ath11k: add read variant from SMBIOS for download board data

Kalle Valo kvalo at kernel.org
Mon Mar 21 03:33:44 PDT 2022


Wen Gong <quic_wgong at quicinc.com> writes:

> This is to read variant from SMBIOS such as read from DT, the variant
> string will be used to one part of string which used to search board
> data from board-2.bin.
>
> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
>
> Signed-off-by: Wen Gong <quic_wgong at quicinc.com>

[...]

> +	/* Copy extension name without magic prefix */
> +	if (strscpy(ab->qmi.target.bdf_ext, smbios->bdf_ext + strlen(magic),
> +		    sizeof(ab->qmi.target.bdf_ext)) < 0) {
> +		ath11k_dbg(ab, ATH11K_DBG_BOOT,
> +			   "bdf variant string is longer than the buffer can accommodate\n");
> +		return;
> +	}

In the pending branch I changed this a bit to follow the style used in
ath11k:

@@ -548,8 +548,9 @@ static void ath11k_core_check_bdfext(const struct dmi_header *hdr, void *data)
        struct ath11k_base *ab = data;
        const char *magic = ATH11K_SMBIOS_BDF_EXT_MAGIC;
        struct ath11k_smbios_bdf *smbios = (struct ath11k_smbios_bdf *)hdr;
-       int i;
+       ssize_t copied;
        size_t len;
+       int i;
 
        if (ab->qmi.target.bdf_ext[0] != '\0')
                return;
@@ -587,8 +588,9 @@ static void ath11k_core_check_bdfext(const struct dmi_header *hdr, void *data)
        }
 
        /* Copy extension name without magic prefix */
-       if (strscpy(ab->qmi.target.bdf_ext, smbios->bdf_ext + strlen(magic),
-                   sizeof(ab->qmi.target.bdf_ext)) < 0) {
+       copied = strscpy(ab->qmi.target.bdf_ext, smbios->bdf_ext + strlen(magic),
+                        sizeof(ab->qmi.target.bdf_ext));
+       if (copied < 0) {
                ath11k_dbg(ab, ATH11K_DBG_BOOT,
                           "bdf variant string is longer than the buffer can accommodate\n");
                return;

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



More information about the ath11k mailing list