Skip to contentSkip to conversation

thermal: ti-soc-thermal: Use helper function IS_ERR_OR_NULL()

PATCH Applied Li Zetao 2 participants 2 messages Aug 17, 2023

Subsystems (2)
lore
Share & tools
lore

Li Zetao

author
#0 lore raw

PATCH 1/1 thermal: ti-soc-thermal: Use helper function IS_ERR_OR_NULL()

Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer open-coding to simplify the code.

---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +1 -1
index a1c9a1530183..0c2eb9c6e58b 100644
@@ -314,7 +314,7 @@ int ti_bandgap_adc_to_mcelsius(struct ti_bandgap *bgp, int adc_val, int *t)
  */
 static inline int ti_bandgap_validate(struct ti_bandgap *bgp, int id)
 {
-	if (!bgp || IS_ERR(bgp)) {
+	if (IS_ERR_OR_NULL(bgp)) {
 		pr_err("%s: invalid bandgap pointer\n", __func__);
 		return -EINVAL;
 	}
Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · Li Zetao

Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer open-coding to simplify the code.

---

Applied, thanks

Signature · 5 lines
<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