[PATCH] nfs: Use IS_ERR_OR_NULL() helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: huhai <huhai@xxxxxxxxxx>

Use the IS_ERR_OR_NULL() helper instead of open-coding a
NULL and an error pointer checks to simplify the code and
improve readability.

No functional changes are intended.

Signed-off-by: huhai <huhai@xxxxxxxxxx>
---
 fs/nfs/write.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 23df8b214474..bf44ab0f5de3 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -637,14 +637,13 @@ static int nfs_page_async_flush(struct folio *folio,
 				struct nfs_pageio_descriptor *pgio)
 {
 	struct nfs_page *req;
-	int ret = 0;
+	int ret;
 
 	req = nfs_lock_and_join_requests(folio);
-	if (!req)
-		goto out;
-	ret = PTR_ERR(req);
-	if (IS_ERR(req))
+	if (IS_ERR_OR_NULL(req)) {
+		ret = PTR_ERR_OR_ZERO(req);
 		goto out;
+	}
 
 	nfs_folio_set_writeback(folio);
 	WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
-- 
2.25.1





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux