PR #22358 opened by commodo URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22358 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22358.patch
Inside the amf_device_derive() function, there seem to be some unreachable 'break' statements, which can be removed. And also the final 'return 0' statement will also be unreachable especially since there is a default case in the switch block. Signed-off-by: Alexandru Ardelean <[email protected]> >From b85d080ecf7965b799c2df2625fc7459273c7dc0 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean <[email protected]> Date: Mon, 2 Mar 2026 13:15:59 +0200 Subject: [PATCH] libavutil: hwcontext_amf: remove unreachable statements Inside the amf_device_derive() function, there seem to be some unreachable 'break' statements, which can be removed. And also the final 'return 0' statement will also be unreachable especially since there is a default case in the switch block. Signed-off-by: Alexandru Ardelean <[email protected]> --- libavutil/hwcontext_amf.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/libavutil/hwcontext_amf.c b/libavutil/hwcontext_amf.c index 57bf08bc65..d6a97c0a51 100644 --- a/libavutil/hwcontext_amf.c +++ b/libavutil/hwcontext_amf.c @@ -638,33 +638,23 @@ static int amf_device_derive(AVHWDeviceContext *device_ctx, return ret; switch (child_device_ctx->type) { - #if CONFIG_DXVA2 - case AV_HWDEVICE_TYPE_DXVA2: { - return amf_init_from_dxva2_device(amf_ctx, child_device_ctx); - } - break; + case AV_HWDEVICE_TYPE_DXVA2: + return amf_init_from_dxva2_device(amf_ctx, child_device_ctx); #endif - #if CONFIG_D3D11VA - case AV_HWDEVICE_TYPE_D3D11VA: { - return amf_init_from_d3d11_device(amf_ctx, child_device_ctx); - } - break; + case AV_HWDEVICE_TYPE_D3D11VA: + return amf_init_from_d3d11_device(amf_ctx, child_device_ctx); #endif #if CONFIG_D3D12VA - case AV_HWDEVICE_TYPE_D3D12VA: { - return amf_init_from_d3d12_device(amf_ctx, child_device_ctx); - } - break; + case AV_HWDEVICE_TYPE_D3D12VA: + return amf_init_from_d3d12_device(amf_ctx, child_device_ctx); #endif - default: { - av_log(child_device_ctx, AV_LOG_ERROR, "AMF initialisation from a %s device is not supported.\n", - av_hwdevice_get_type_name(child_device_ctx->type)); - return AVERROR(ENOSYS); - } + default: + av_log(child_device_ctx, AV_LOG_ERROR, "AMF initialisation from a %s device is not supported.\n", + av_hwdevice_get_type_name(child_device_ctx->type)); + return AVERROR(ENOSYS); } - return 0; } const HWContextType ff_hwcontext_type_amf = { -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
