5b212a2a372ea49c0fed2f4c47ccaef1aa24d1e2
[openwrt/staging/ldir.git] /
1 From fb1bbb5b63e4e3c788a978724749ced57d208054 Mon Sep 17 00:00:00 2001
2 From: Minjie Du <duminjie@vivo.com>
3 Date: Thu, 21 Sep 2023 17:10:50 +0800
4 Subject: [PATCH 38/42] thermal/drivers/mediatek/lvts_thermal: Fix error check
5 in lvts_debugfs_init()
6
7 debugfs_create_dir() function returns an error value embedded in
8 the pointer (PTR_ERR). Evaluate the return value using IS_ERR
9 rather than checking for NULL.
10
11 Signed-off-by: Minjie Du <duminjie@vivo.com>
12 Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
13 Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
14 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
15 Link: https://lore.kernel.org/r/20230921091057.3812-1-duminjie@vivo.com
16 ---
17 drivers/thermal/mediatek/lvts_thermal.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20 --- a/drivers/thermal/mediatek/lvts_thermal.c
21 +++ b/drivers/thermal/mediatek/lvts_thermal.c
22 @@ -219,7 +219,7 @@ static int lvts_debugfs_init(struct devi
23
24 sprintf(name, "controller%d", i);
25 dentry = debugfs_create_dir(name, lvts_td->dom_dentry);
26 - if (!dentry)
27 + if (IS_ERR(dentry))
28 continue;
29
30 regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);