[...]
> +static const char *fb_block_interface(void)
> +{
> + if (!IS_ENABLED(CONFIG_FASTBOOT_FLASH_BLOCK))
> + return NULL;
> +
> + if (block_interface_override[0])
> + return block_interface_override;
> +
> + return config_opt_enabled(CONFIG_FASTBOOT_FLASH_BLOCK,
> + CONFIG_FASTBOOT_FLASH_BLOCK_INTERFACE_NAME,
> NULL);
If CONFIG_FASTBOOT_FLASH_BLOCK was not enabled, the code wouldn't have
reached here. The first if check would have caught it. So a plain return
CONFIG_FASTBOOT_FLASH_BLOCK_INTERFACE_NAME would suffice.
> +}
> +
> +/**
> + * fb_block_device() - Resolve the block device number to use
> + *
> + * Returns the runtime override set via fastboot_block_set_target() if one
> + * is active, otherwise falls back to the build-time config default.
> + */
> +static int fb_block_device(void)
> +{
> + if (!IS_ENABLED(CONFIG_FASTBOOT_FLASH_BLOCK))
> + return -1;
> +
> + if (block_device_override >= 0)
> + return block_device_override;
> +
> + return config_opt_enabled(CONFIG_FASTBOOT_FLASH_BLOCK,
> + CONFIG_FASTBOOT_FLASH_BLOCK_DEVICE_ID, -1);
> +}
Same as above.
[...]
> +static void __maybe_unused oem_set_block_target(char *cmd_parameter, char
> *response)
> +{
> + char interface[16] = { 0 };
> + int device = -1;
> + char *space;
> +
> + if (!cmd_parameter) {
> + fastboot_fail("Expected command parameter", response);
> + return;
> + }
> +
> + space = strchr(cmd_parameter, ' ');
> + if (space) {
> + size_t len = space - cmd_parameter;
> +
> + if (len >= sizeof(interface)) {
> + fastboot_fail("interface name too long", response);
> + return;
> + }
> + memcpy(interface, cmd_parameter, len);
> + interface[len] = '\0';
> + device = simple_strtoul(space + 1, NULL, 10);
simple_strtol since device is int?
Thanks
Varada
[...]