Skip to contentSkip to conversation

PNP: pnpbios: Use PTR_ERR_OR_ZERO()

PATCH Applied Vasyl Gomonovych 3 participants 3 messages Nov 29, 2017 – Dec 17, 2017 Pnp support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PNP: pnpbios: Use PTR_ERR_OR_ZERO()

Fix ptr_ret.cocci warnings:
drivers/pnp/pnpbios/core.c:584:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

---
 drivers/pnp/pnpbios/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pnp/pnpbios/core.c +1 -4
index e681140b85d8..077f334fdbae 100644
@@ -581,10 +581,7 @@ static int __init pnpbios_thread_init(void)
 
 	init_completion(&unload_sem);
 	task = kthread_run(pnp_dock_thread, NULL, "kpnpbiosd");
-	if (IS_ERR(task))
-		return PTR_ERR(task);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(task);
 }
 
 /* Start the kernel thread later: */
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Vasyl Gomonovych

Fix ptr_ret.cocci warnings:
drivers/pnp/pnpbios/core.c:584:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

---
 drivers/pnp/pnpbios/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pnp/pnpbios/core.c +0 -0
index e681140b85d8..077f334fdbae 100644
@@ -581,10 +581,7 @@ static int __init pnpbios_thread_init(void)
 

drivers/pnp/pnpbios/core.c static int __init pnpbios_thread_init(void) · line 587

Quoted 10 lines
drivers/pnp/pnpbios/core.c +1 -4
 	init_completion(&unload_sem);
 	task = kthread_run(pnp_dock_thread, NULL, "kpnpbiosd");
-	if (IS_ERR(task))
-		return PTR_ERR(task);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(task);
 }
 
 /* Start the kernel thread later: */

Looks good to me.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#2 lore raw
Quoted 28 lines · CET Jean Delvare
Quoted 27 lines · Vasyl Gomonovych

Fix ptr_ret.cocci warnings:
drivers/pnp/pnpbios/core.c:584:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

---
 drivers/pnp/pnpbios/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pnp/pnpbios/core.c +1 -4
index e681140b85d8..077f334fdbae 100644
@@ -581,10 +581,7 @@ static int __init pnpbios_thread_init(void)
 
 	init_completion(&unload_sem);
 	task = kthread_run(pnp_dock_thread, NULL, "kpnpbiosd");
-	if (IS_ERR(task))
-		return PTR_ERR(task);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(task);
 }
 
Quoted 7 lines

drivers/pnp/pnpbios/core.c static int __init pnpbios_thread_init(void) · line 587

Quoted 1 line
drivers/pnp/pnpbios/core.c +0 -0
 /* Start the kernel thread later: */

Looks good to me.

Applied, thanks!