Skip to contentSkip to conversation

x86/platform/olpc: Use the PTR_ERR_OR_ZERO to simplify the code

PATCH New zhong jiang 2 participants 2 messages Jul 31, 2018 – Aug 2, 2018 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/platform/olpc: Use the PTR_ERR_OR_ZERO to simplify the code

use PTR_ERR_OR_ZERO is better than the open code

---
 arch/x86/platform/olpc/olpc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/platform/olpc/olpc.c +1 -3
index 7c3077e..f0e920f 100644
@@ -311,10 +311,8 @@ static int __init add_xo1_platform_devices(void)
 		return PTR_ERR(pdev);
 
 	pdev = platform_device_register_simple("olpc-xo1", -1, NULL, 0);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pdev);
 }
 
 static int olpc_xo1_ec_probe(struct platform_device *pdev)
Signature · 1 line
1.7.12.4
#1 lore raw

[tip:x86/platform] x86/platform/olpc: Use PTR_ERR_OR_ZERO()

x86/platform/olpc: Use PTR_ERR_OR_ZERO()
Commit-ID:  c7ba9f7cb55926605983187a68624999b93abb94
Gitweb:     https://git.kernel.org/tip/c7ba9f7cb55926605983187a68624999b93abb94
Author:     zhong jiang <[email protected]>
AuthorDate: Wed, 1 Aug 2018 00:08:06 +0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 2 Aug 2018 14:25:40 +0200

x86/platform/olpc: Use PTR_ERR_OR_ZERO()

Replace the open coded equivalent with PTR_ERR_OR_ZERO().

---
 arch/x86/platform/olpc/olpc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/platform/olpc/olpc.c +1 -3
index 7c3077e58fa0..f0e920fb98ad 100644
@@ -311,10 +311,8 @@ static int __init add_xo1_platform_devices(void)
 		return PTR_ERR(pdev);
 
 	pdev = platform_device_register_simple("olpc-xo1", -1, NULL, 0);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pdev);
 }
 
 static int olpc_xo1_ec_probe(struct platform_device *pdev)