Re: [PATCH 5/7] media-info: fix NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/04/2020 20:46, Rosen Penev wrote:
> Found with clang-tidy's bugprone-bool-pointer-implicit-conversion
> 
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
>  utils/common/media-info.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
> index b0f0bc41..cb48d0df 100644
> --- a/utils/common/media-info.cpp
> +++ b/utils/common/media-info.cpp
> @@ -357,7 +357,7 @@ std::string mi_entfunction2s(__u32 function, bool *is_invalid)
>  			return fail ? entity_functions_def[i].str + 6 : entity_functions_def[i].str;
>  		}
>  	}
> -	if (is_invalid)
> +	if (is_invalid != NULL)
>  		return "WARNING: Unknown Function (" + num2s(function) + "), is v4l2-compliance out-of-date?";
>  	return "Unknown Function (" + num2s(function) + ")";
>  }
> 

This makes no sense: why just this instance when there are a lot more
'if (is_invalid)' checks in this function?

In any case, this is also normal idiom and I don't want to apply this patch.

Regards,

	Hans



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux