Skip to contentSkip to conversation

PM / OPP: Use ERR_CAST inlined function

PATCH Applied Thomas Meyer 2 participants 2 messages Nov 8, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / OPP: Use ERR_CAST inlined function

From: Thomas Meyer <[email protected]>

Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

The semantic patch that makes this change is available in scripts/coccinelle/api/err_cast.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

---

drivers/base/power/opp.c 2011-11-08 09:55:51.808539048 +0100 renamed from drivers/base/power/opp.c 2011-11-07 19:37:43.009876832 +0100 +1 -1
diff -u -p a/drivers/base/power/opp.c b/drivers/base/power/opp.c
@@ -669,7 +669,7 @@ struct srcu_notifier_head *opp_get_notif
 	struct device_opp *dev_opp = find_device_opp(dev);
 
 	if (IS_ERR(dev_opp))
-		return ERR_PTR(PTR_ERR(dev_opp)); /* matching type */
+		return ERR_CAST(dev_opp); /* matching type */
 
 	return &dev_opp->head;
 }
#1 lore raw
Quoted 11 lines · Thomas Meyer

From: Thomas Meyer <[email protected]>

Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

The semantic patch that makes this change is available in scripts/coccinelle/api/err_cast.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Applied to linux-pm/pm-fixes, will push to Linus shortly.

Thanks,
Rafael

Quoted 18 lines

---

diff -u -p a/drivers/base/power/opp.c b/drivers/base/power/opp.c

drivers/base/power/opp.c 2011-11-08 09:55:51.808539048 +0100 renamed from drivers/base/power/opp.c 2011-11-07 19:37:43.009876832 +0100 +1 -1
@@ -669,7 +669,7 @@ struct srcu_notifier_head *opp_get_notif
 	struct device_opp *dev_opp = find_device_opp(dev);
 
 	if (IS_ERR(dev_opp))
-		return ERR_PTR(PTR_ERR(dev_opp)); /* matching type */
+		return ERR_CAST(dev_opp); /* matching type */
 
 	return &dev_opp->head;
 }