From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Osama Muhammad <osmtendev@gmail.com>,
rafael@kernel.org, amitk@kernel.org, rui.zhang@intel.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
bchihi@baylibre.com, wenst@chromium.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lvts_thermal.c: Fix error checking for debugfs_create_dir
Date: Tue, 30 May 2023 17:47:12 +0200 [thread overview]
Message-ID: <35dea714-6a0f-4673-fd33-23644ea85d33@linaro.org> (raw)
In-Reply-To: <20230517160326.10732-1-osmtendev@gmail.com>
On 17/05/2023 18:03, Osama Muhammad wrote:
> This patch fixes the error checking in lvts_thermal.c in
> debugfs_create_dir. The correct way to check if an error occurred
> is 'IS_ERR' inline function.
We do no longer check debugfs functions return values.
eg.
https://www.spinics.net/lists/linux-spi/msg37903.html
https://lore.kernel.org/lkml/2023052835-oxidant-doily-404f@gregkh/
> Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
> ---
> drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index d0a3f95b7884..61386be78fa0 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -188,7 +188,7 @@ static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
> int i;
>
> lvts_td->dom_dentry = debugfs_create_dir(dev_name(dev), NULL);
> - if (!lvts_td->dom_dentry)
> + if (IS_ERR(lvts_td->dom_dentry))
> return 0;
>
> for (i = 0; i < lvts_td->num_lvts_ctrl; i++) {
> @@ -197,7 +197,7 @@ static int lvts_debugfs_init(struct device *dev, struct lvts_domain *lvts_td)
>
> sprintf(name, "controller%d", i);
> dentry = debugfs_create_dir(name, lvts_td->dom_dentry);
> - if (!dentry)
> + if (IS_ERR(dentry))
> continue;
>
> regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2023-05-30 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 16:03 [PATCH] lvts_thermal.c: Fix error checking for debugfs_create_dir Osama Muhammad
2023-05-30 15:47 ` Daniel Lezcano [this message]
2023-05-30 15:54 ` Osama Muhammad
2023-05-30 16:15 ` Daniel Lezcano
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=35dea714-6a0f-4673-fd33-23644ea85d33@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bchihi@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=osmtendev@gmail.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=wenst@chromium.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).