* [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path
@ 2018-07-31 16:13 zhong jiang
2018-08-01 7:41 ` Johannes Thumshirn
2018-08-01 15:13 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: zhong jiang @ 2018-07-31 16:13 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel
Simplify the code by using the PTR_ERR_OR_ZERO, instead of the
open code. It is better.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
block/bsg-lib.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index 9419def..f3501cd 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -48,9 +48,8 @@ static int bsg_transport_fill_hdr(struct request *rq, struct sg_io_v4 *hdr,
job->request_len = hdr->request_len;
job->request = memdup_user(uptr64(hdr->request), hdr->request_len);
- if (IS_ERR(job->request))
- return PTR_ERR(job->request);
- return 0;
+
+ return PTR_ERR_OR_ZERO(job->request);
}
static int bsg_transport_complete_rq(struct request *rq, struct sg_io_v4 *hdr)
--
1.7.12.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path
2018-07-31 16:13 [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path zhong jiang
@ 2018-08-01 7:41 ` Johannes Thumshirn
2018-08-01 15:13 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2018-08-01 7:41 UTC (permalink / raw)
To: zhong jiang; +Cc: axboe, linux-block, linux-kernel
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path
2018-07-31 16:13 [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path zhong jiang
2018-08-01 7:41 ` Johannes Thumshirn
@ 2018-08-01 15:13 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2018-08-01 15:13 UTC (permalink / raw)
To: zhong jiang; +Cc: linux-block, linux-kernel
On 7/31/18 10:13 AM, zhong jiang wrote:
> Simplify the code by using the PTR_ERR_OR_ZERO, instead of the
> open code. It is better.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-08-01 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31 16:13 [PATCH] block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path zhong jiang
2018-08-01 7:41 ` Johannes Thumshirn
2018-08-01 15:13 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).