Skip to content

Commit

Permalink
block/bsg-lib: use PTR_ERR_OR_ZERO to simplify the flow path
Browse files Browse the repository at this point in the history
Simplify the code by using the PTR_ERR_OR_ZERO, instead of the
open code. It is better.

Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: zhong jiang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
xiongzhongjiang authored and axboe committed Aug 1, 2018
1 parent 08fcf81 commit 4725549
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions block/bsg-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4725549

Please sign in to comment.