830-v6.7-43-thermal-drivers-mediatek-lvts_thermal-Fix-error-chec.patch 1.1 KB

123456789101112131415161718192021222324252627282930
  1. From fb1bbb5b63e4e3c788a978724749ced57d208054 Mon Sep 17 00:00:00 2001
  2. From: Minjie Du <[email protected]>
  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. debugfs_create_dir() function returns an error value embedded in
  7. the pointer (PTR_ERR). Evaluate the return value using IS_ERR
  8. rather than checking for NULL.
  9. Signed-off-by: Minjie Du <[email protected]>
  10. Reviewed-by: Alexandre Mergnat <[email protected]>
  11. Reviewed-by: Chen-Yu Tsai <[email protected]>
  12. Signed-off-by: Daniel Lezcano <[email protected]>
  13. Link: https://lore.kernel.org/r/[email protected]
  14. ---
  15. drivers/thermal/mediatek/lvts_thermal.c | 2 +-
  16. 1 file changed, 1 insertion(+), 1 deletion(-)
  17. --- a/drivers/thermal/mediatek/lvts_thermal.c
  18. +++ b/drivers/thermal/mediatek/lvts_thermal.c
  19. @@ -219,7 +219,7 @@ static int lvts_debugfs_init(struct devi
  20. sprintf(name, "controller%d", i);
  21. dentry = debugfs_create_dir(name, lvts_td->dom_dentry);
  22. - if (!dentry)
  23. + if (IS_ERR(dentry))
  24. continue;
  25. regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);