diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-08-01 00:13:14 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-01 09:13:03 -0600 |
commit | 4725549192c9633b6a3740bf23770cb758bee4a0 (patch) | |
tree | f914b33624a7650377e265e68eb34bde3c35983a /block | |
parent | 08fcf813281ebcf72c69487c1501ad91b7121cdb (diff) | |
download | linux-4725549192c9633b6a3740bf23770cb758bee4a0.tar.gz linux-4725549192c9633b6a3740bf23770cb758bee4a0.tar.bz2 linux-4725549192c9633b6a3740bf23770cb758bee4a0.zip |
block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path
Simplify the code by using the PTR_ERR_OR_ZERO, instead of the
open code. It is better.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/bsg-lib.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/block/bsg-lib.c b/block/bsg-lib.c index 9419def8c017..f3501cdaf1a6 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) |