public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR())
@ 2021-10-20  8:49 cgel.zte
  2021-10-20  8:54 ` Pavel Begunkov
  2021-10-20 14:02 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2021-10-20  8:49 UTC (permalink / raw)
  To: axboe; +Cc: asml.silence, io-uring, linux-kernel, Changcheng Deng, Zeal Robot

From: Changcheng Deng <[email protected]>

Use ERR_CAST() instead of ERR_PTR(PTR_ERR()).
This makes it more readable and also fix this warning detected by
err_cast.cocci:
./fs/io_uring.c: WARNING: 3208: 11-18: ERR_CAST can be used with buf

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Changcheng Deng <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 695388aff926..e2d36607bf94 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3205,7 +3205,7 @@ static struct iovec *__io_import_iovec(int rw, struct io_kiocb *req,
 		if (req->flags & REQ_F_BUFFER_SELECT) {
 			buf = io_rw_buffer_select(req, &sqe_len, issue_flags);
 			if (IS_ERR(buf))
-				return ERR_PTR(PTR_ERR(buf));
+				return ERR_CAST(buf);
 			req->rw.len = sqe_len;
 		}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR())
  2021-10-20  8:49 [PATCH] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR()) cgel.zte
@ 2021-10-20  8:54 ` Pavel Begunkov
  2021-10-20 14:02 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Begunkov @ 2021-10-20  8:54 UTC (permalink / raw)
  To: cgel.zte, axboe; +Cc: io-uring, linux-kernel, Changcheng Deng, Zeal Robot

On 10/20/21 09:49, [email protected] wrote:
> From: Changcheng Deng <[email protected]>
> 
> Use ERR_CAST() instead of ERR_PTR(PTR_ERR()).

Makes more sense, looks good

> This makes it more readable and also fix this warning detected by
> err_cast.cocci:
> ./fs/io_uring.c: WARNING: 3208: 11-18: ERR_CAST can be used with buf
> 

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR())
  2021-10-20  8:49 [PATCH] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR()) cgel.zte
  2021-10-20  8:54 ` Pavel Begunkov
@ 2021-10-20 14:02 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-10-20 14:02 UTC (permalink / raw)
  To: cgel.zte
  Cc: Jens Axboe, Changcheng Deng, io-uring, Zeal Robot, asml.silence,
	linux-kernel

On Wed, 20 Oct 2021 08:49:48 +0000, [email protected] wrote:
> From: Changcheng Deng <[email protected]>
> 
> Use ERR_CAST() instead of ERR_PTR(PTR_ERR()).
> This makes it more readable and also fix this warning detected by
> err_cast.cocci:
> ./fs/io_uring.c: WARNING: 3208: 11-18: ERR_CAST can be used with buf
> 
> [...]

Applied, thanks!

[1/1] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR())
      commit: 898df2447b9ee8d759e85d33087505d3905bf2f0

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-20 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-20  8:49 [PATCH] io_uring: Use ERR_CAST() instead of ERR_PTR(PTR_ERR()) cgel.zte
2021-10-20  8:54 ` Pavel Begunkov
2021-10-20 14:02 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox