Commit d46fe2cb authored by Martin Wilck's avatar Martin Wilck Committed by Jens Axboe

block: drop device references in bsg_queue_rq()

Make sure that bsg_queue_rq() calls put_device() if an error is
encountered after get_device() was successful.

Fixes: cd2f076f ("bsg: convert to use blk-mq")
Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent be21683e
...@@ -266,6 +266,7 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -266,6 +266,7 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx,
struct request *req = bd->rq; struct request *req = bd->rq;
struct bsg_set *bset = struct bsg_set *bset =
container_of(q->tag_set, struct bsg_set, tag_set); container_of(q->tag_set, struct bsg_set, tag_set);
int sts = BLK_STS_IOERR;
int ret; int ret;
blk_mq_start_request(req); blk_mq_start_request(req);
...@@ -274,14 +275,15 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -274,14 +275,15 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx,
return BLK_STS_IOERR; return BLK_STS_IOERR;
if (!bsg_prepare_job(dev, req)) if (!bsg_prepare_job(dev, req))
return BLK_STS_IOERR; goto out;
ret = bset->job_fn(blk_mq_rq_to_pdu(req)); ret = bset->job_fn(blk_mq_rq_to_pdu(req));
if (ret) if (!ret)
return BLK_STS_IOERR; sts = BLK_STS_OK;
out:
put_device(dev); put_device(dev);
return BLK_STS_OK; return sts;
} }
/* called right after the request is allocated for the request_queue */ /* called right after the request is allocated for the request_queue */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment