Skip to contentSkip to conversation

staging: android: Remove unused variable ret for immediate return result.

PATCH In review Rakhi Sharma 2 participants 2 messages Feb 27, 2016 – Mar 11, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: Remove unused variable ret for immediate return result.

This patch remove unused ret variable and merge two line for immediate result.
This is done using Coccinelle.Semantic patch used is:

@@
expression ret;
identifier f;
@@

-ret =
+return

     f(...);

-return ret;

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +1 -2
index e3c07b2..9922710 100644
@@ -216,8 +216,7 @@ static int __init hi6220_ion_init(void)
 {
 	int ret;
 
-	ret = platform_driver_register(&hi6220_ion_driver);
-	return ret;
+	return platform_driver_register(&hi6220_ion_driver);
 }
 
 subsys_initcall(hi6220_ion_init);
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 24 lines · Rakhi Sharma

This patch remove unused ret variable and merge two line for immediate result.
This is done using Coccinelle.Semantic patch used is:

@@
expression ret;
identifier f;
@@

(quoted diff) +1 -2
-ret =
+return
     f(...);
-return ret;
---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +0 -0
index e3c07b2..9922710 100644

drivers/staging/android/ion/hisilicon/hi6220_ion.c static int __init hi6220_ion_init(void) · line 219

Quoted 6 lines
drivers/staging/android/ion/hisilicon/hi6220_ion.c +1 -2
@@ -216,8 +216,7 @@ static int __init hi6220_ion_init(void)
 {
 	int ret;
 
-	ret = platform_driver_register(&hi6220_ion_driver);
-	return ret;
+	return platform_driver_register(&hi6220_ion_driver);

And now you have a build warning :(

Please always test-build your patches...