From: Greg KH <gregkh@linuxfoundation.org>
To: Li Zetao <lizetao1@huawei.com>
Cc: hverkuil-cisco@xs4all.nl, mchehab@kernel.org,
ricardo@marliere.net, laurent.pinchart+renesas@ideasonboard.com,
ruanjinjie@huawei.com, linux-media@vger.kernel.org
Subject: Re: [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
Date: Tue, 3 Sep 2024 20:01:31 +0200 [thread overview]
Message-ID: <2024090358-pacifism-napping-728b@gregkh> (raw)
In-Reply-To: <20240903143607.2004802-1-lizetao1@huawei.com>
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@huawei.com>
> ---
> 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
prev parent reply other threads:[~2024-09-03 18:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 14:36 [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
2024-09-03 14:36 ` [PATCH -next 2/2] media: siano: " Li Zetao
2024-09-03 18:01 ` Greg KH
2024-09-03 18:01 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2024090358-pacifism-napping-728b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=lizetao1@huawei.com \
--cc=mchehab@kernel.org \
--cc=ricardo@marliere.net \
--cc=ruanjinjie@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.