Re: [PATCH v2 06/35] brcmfmac: firmware: Support passing in multiple board_types

From: Andy Shevchenko
Date: Tue Jan 04 2022 - 06:30:40 EST


On Tue, Jan 4, 2022 at 9:28 AM Hector Martin <marcan@xxxxxxxxx> wrote:
>
> In order to make use of the multiple alt_path functionality, change
> board_type to an array. Bus drivers can pass in a NULL-terminated list
> of board type strings to try for the firmware fetch.

> + /* strip extension at the end */
> + strscpy(alt_path, path, BRCMF_FW_NAME_LEN);
> + alt_path[suffix - path] = 0;
>
> - alt_paths[0] = kstrdup(alt_path, GFP_KERNEL);
> + strlcat(alt_path, ".", BRCMF_FW_NAME_LEN);
> + strlcat(alt_path, board_types[i], BRCMF_FW_NAME_LEN);
> + strlcat(alt_path, suffix, BRCMF_FW_NAME_LEN);
> +
> + alt_paths[i] = kstrdup(alt_path, GFP_KERNEL);
> + brcmf_dbg(TRACE, "FW alt path: %s\n", alt_paths[i]);

Consider replacing these string manipulations with kasprintf().

--
With Best Regards,
Andy Shevchenko