[PATCH] configfs: use PTR_ERR_OR_ZERO() to simplify code

Xichao Zhao posted 1 patch 1 month, 3 weeks ago
fs/configfs/dir.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH] configfs: use PTR_ERR_OR_ZERO() to simplify code
Posted by Xichao Zhao 1 month, 3 weeks ago
Use the standard error pointer macro to shorten the code and simplify.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 fs/configfs/dir.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index f327fbb9a0ca..81f4f06bc87e 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1601,10 +1601,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
 	err = -ENOENT;
 	if (configfs_dirent_is_ready(parent_sd)) {
 		file->private_data = configfs_new_dirent(parent_sd, NULL, 0, NULL);
-		if (IS_ERR(file->private_data))
-			err = PTR_ERR(file->private_data);
-		else
-			err = 0;
+		err = PTR_ERR_OR_ZERO(file->private_data);
 	}
 	inode_unlock(d_inode(dentry));
 
-- 
2.34.1
Re: [PATCH] configfs: use PTR_ERR_OR_ZERO() to simplify code
Posted by Andreas Hindborg 1 month ago
On Tue, 12 Aug 2025 16:27:09 +0800, Xichao Zhao wrote:
> Use the standard error pointer macro to shorten the code and simplify.
> 
> 

Applied, thanks!

[1/1] configfs: use PTR_ERR_OR_ZERO() to simplify code
      commit: 462272dd734b568f0190d01e24f5257c1a763fae

Best regards,
-- 
Andreas Hindborg <a.hindborg@kernel.org>
Re: [PATCH] configfs: use PTR_ERR_OR_ZERO() to simplify code
Posted by Breno Leitao 1 month, 3 weeks ago
On Tue, Aug 12, 2025 at 04:27:09PM +0800, Xichao Zhao wrote:
> Use the standard error pointer macro to shorten the code and simplify.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>

Reviewed-by: Breno Leitao <leitao@debian.org>