Re: [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()

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

 



On Tue, Sep 03, 2024 at 10:36:06PM +0800, Li Zetao wrote:
> Since the debugfs_create_dir() never returns a null pointer, checking
> the return value for a null pointer is redundant, and using IS_ERR is
> safe enough.
> 
> Signed-off-by: Li Zetao <lizetao1@xxxxxxxxxx>
> ---
>  drivers/media/cec/core/cec-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
> index e0756826d629..b4135447cdae 100644
> --- a/drivers/media/cec/core/cec-core.c
> +++ b/drivers/media/cec/core/cec-core.c
> @@ -441,7 +441,7 @@ static int __init cec_devnode_init(void)
>  
>  #ifdef CONFIG_DEBUG_FS

This ifdef should not be needed.

>  	top_cec_dir = debugfs_create_dir("cec", NULL);
> -	if (IS_ERR_OR_NULL(top_cec_dir)) {
> +	if (IS_ERR(top_cec_dir)) {
>  		pr_warn("cec: Failed to create debugfs cec dir\n");

No need to tell anyone anything, or ever check the return value of a
debugfs call, please change the logic to that.

>  		top_cec_dir = NULL;

Not needed either.

thanks,

greg k-h




[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