From: zhong jiang Date: Tue, 31 Jul 2018 16:13:14 +0000 (+0800) Subject: block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=4725549192c9633b6a3740bf23770cb758bee4a0;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: zhong jiang Signed-off-by: Jens Axboe --- 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)