Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 1 | /* |
| 2 | * BSG helper library |
| 3 | * |
| 4 | * Copyright (C) 2008 James Smart, Emulex Corporation |
| 5 | * Copyright (C) 2011 Red Hat, Inc. All rights reserved. |
| 6 | * Copyright (C) 2011 Mike Christie |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | * |
| 22 | */ |
| 23 | #include <linux/slab.h> |
| 24 | #include <linux/blkdev.h> |
| 25 | #include <linux/delay.h> |
| 26 | #include <linux/scatterlist.h> |
| 27 | #include <linux/bsg-lib.h> |
Paul Gortmaker | 6adb123 | 2011-09-28 18:26:05 -0400 | [diff] [blame] | 28 | #include <linux/export.h> |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 29 | #include <scsi/scsi_cmnd.h> |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 30 | #include <scsi/sg.h> |
| 31 | |
| 32 | #define uptr64(val) ((void __user *)(uintptr_t)(val)) |
| 33 | |
| 34 | static int bsg_transport_check_proto(struct sg_io_v4 *hdr) |
| 35 | { |
| 36 | if (hdr->protocol != BSG_PROTOCOL_SCSI || |
| 37 | hdr->subprotocol != BSG_SUB_PROTOCOL_SCSI_TRANSPORT) |
| 38 | return -EINVAL; |
| 39 | if (!capable(CAP_SYS_RAWIO)) |
| 40 | return -EPERM; |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | static int bsg_transport_fill_hdr(struct request *rq, struct sg_io_v4 *hdr, |
| 45 | fmode_t mode) |
| 46 | { |
| 47 | struct bsg_job *job = blk_mq_rq_to_pdu(rq); |
| 48 | |
| 49 | job->request_len = hdr->request_len; |
| 50 | job->request = memdup_user(uptr64(hdr->request), hdr->request_len); |
zhong jiang | 4725549 | 2018-08-01 00:13:14 +0800 | [diff] [blame] | 51 | |
| 52 | return PTR_ERR_OR_ZERO(job->request); |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | static int bsg_transport_complete_rq(struct request *rq, struct sg_io_v4 *hdr) |
| 56 | { |
| 57 | struct bsg_job *job = blk_mq_rq_to_pdu(rq); |
| 58 | int ret = 0; |
| 59 | |
| 60 | /* |
| 61 | * The assignments below don't make much sense, but are kept for |
| 62 | * bug by bug backwards compatibility: |
| 63 | */ |
| 64 | hdr->device_status = job->result & 0xff; |
| 65 | hdr->transport_status = host_byte(job->result); |
| 66 | hdr->driver_status = driver_byte(job->result); |
| 67 | hdr->info = 0; |
| 68 | if (hdr->device_status || hdr->transport_status || hdr->driver_status) |
| 69 | hdr->info |= SG_INFO_CHECK; |
| 70 | hdr->response_len = 0; |
| 71 | |
| 72 | if (job->result < 0) { |
| 73 | /* we're only returning the result field in the reply */ |
| 74 | job->reply_len = sizeof(u32); |
| 75 | ret = job->result; |
| 76 | } |
| 77 | |
| 78 | if (job->reply_len && hdr->response) { |
| 79 | int len = min(hdr->max_response_len, job->reply_len); |
| 80 | |
| 81 | if (copy_to_user(uptr64(hdr->response), job->reply, len)) |
| 82 | ret = -EFAULT; |
| 83 | else |
| 84 | hdr->response_len = len; |
| 85 | } |
| 86 | |
| 87 | /* we assume all request payload was transferred, residual == 0 */ |
| 88 | hdr->dout_resid = 0; |
| 89 | |
| 90 | if (rq->next_rq) { |
| 91 | unsigned int rsp_len = job->reply_payload.payload_len; |
| 92 | |
| 93 | if (WARN_ON(job->reply_payload_rcv_len > rsp_len)) |
| 94 | hdr->din_resid = 0; |
| 95 | else |
| 96 | hdr->din_resid = rsp_len - job->reply_payload_rcv_len; |
| 97 | } else { |
| 98 | hdr->din_resid = 0; |
| 99 | } |
| 100 | |
| 101 | return ret; |
| 102 | } |
| 103 | |
| 104 | static void bsg_transport_free_rq(struct request *rq) |
| 105 | { |
| 106 | struct bsg_job *job = blk_mq_rq_to_pdu(rq); |
| 107 | |
| 108 | kfree(job->request); |
| 109 | } |
| 110 | |
| 111 | static const struct bsg_ops bsg_transport_ops = { |
| 112 | .check_proto = bsg_transport_check_proto, |
| 113 | .fill_hdr = bsg_transport_fill_hdr, |
| 114 | .complete_rq = bsg_transport_complete_rq, |
| 115 | .free_rq = bsg_transport_free_rq, |
| 116 | }; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 117 | |
| 118 | /** |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 119 | * bsg_teardown_job - routine to teardown a bsg job |
Bart Van Assche | aa98192 | 2018-01-09 10:11:00 -0800 | [diff] [blame] | 120 | * @kref: kref inside bsg_job that is to be torn down |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 121 | */ |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 122 | static void bsg_teardown_job(struct kref *kref) |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 123 | { |
Johannes Thumshirn | bf0f2d3 | 2016-11-17 10:31:18 +0100 | [diff] [blame] | 124 | struct bsg_job *job = container_of(kref, struct bsg_job, kref); |
Christoph Hellwig | ef6fa64 | 2018-03-13 17:28:40 +0100 | [diff] [blame] | 125 | struct request *rq = blk_mq_rq_from_pdu(job); |
Johannes Thumshirn | c00da4c | 2016-11-17 10:31:20 +0100 | [diff] [blame] | 126 | |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 127 | put_device(job->dev); /* release reference for the request */ |
| 128 | |
| 129 | kfree(job->request_payload.sg_list); |
| 130 | kfree(job->reply_payload.sg_list); |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 131 | |
| 132 | blk_end_request_all(rq, BLK_STS_OK); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 133 | } |
| 134 | |
Johannes Thumshirn | fb6f7c8 | 2016-11-17 10:31:23 +0100 | [diff] [blame] | 135 | void bsg_job_put(struct bsg_job *job) |
| 136 | { |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 137 | kref_put(&job->kref, bsg_teardown_job); |
Johannes Thumshirn | fb6f7c8 | 2016-11-17 10:31:23 +0100 | [diff] [blame] | 138 | } |
| 139 | EXPORT_SYMBOL_GPL(bsg_job_put); |
| 140 | |
| 141 | int bsg_job_get(struct bsg_job *job) |
| 142 | { |
| 143 | return kref_get_unless_zero(&job->kref); |
| 144 | } |
| 145 | EXPORT_SYMBOL_GPL(bsg_job_get); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 146 | |
| 147 | /** |
| 148 | * bsg_job_done - completion routine for bsg requests |
| 149 | * @job: bsg_job that is complete |
| 150 | * @result: job reply result |
| 151 | * @reply_payload_rcv_len: length of payload recvd |
| 152 | * |
| 153 | * The LLD should call this when the bsg job has completed. |
| 154 | */ |
| 155 | void bsg_job_done(struct bsg_job *job, int result, |
| 156 | unsigned int reply_payload_rcv_len) |
| 157 | { |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 158 | job->result = result; |
| 159 | job->reply_payload_rcv_len = reply_payload_rcv_len; |
| 160 | blk_complete_request(blk_mq_rq_from_pdu(job)); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 161 | } |
| 162 | EXPORT_SYMBOL_GPL(bsg_job_done); |
| 163 | |
| 164 | /** |
| 165 | * bsg_softirq_done - softirq done routine for destroying the bsg requests |
| 166 | * @rq: BSG request that holds the job to be destroyed |
| 167 | */ |
| 168 | static void bsg_softirq_done(struct request *rq) |
| 169 | { |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 170 | struct bsg_job *job = blk_mq_rq_to_pdu(rq); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 171 | |
Johannes Thumshirn | fb6f7c8 | 2016-11-17 10:31:23 +0100 | [diff] [blame] | 172 | bsg_job_put(job); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | static int bsg_map_buffer(struct bsg_buffer *buf, struct request *req) |
| 176 | { |
| 177 | size_t sz = (sizeof(struct scatterlist) * req->nr_phys_segments); |
| 178 | |
| 179 | BUG_ON(!req->nr_phys_segments); |
| 180 | |
| 181 | buf->sg_list = kzalloc(sz, GFP_KERNEL); |
| 182 | if (!buf->sg_list) |
| 183 | return -ENOMEM; |
| 184 | sg_init_table(buf->sg_list, req->nr_phys_segments); |
| 185 | buf->sg_cnt = blk_rq_map_sg(req->q, req, buf->sg_list); |
| 186 | buf->payload_len = blk_rq_bytes(req); |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | /** |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 191 | * bsg_prepare_job - create the bsg_job structure for the bsg request |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 192 | * @dev: device that is being sent the bsg request |
| 193 | * @req: BSG request that needs a job structure |
| 194 | */ |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 195 | static bool bsg_prepare_job(struct device *dev, struct request *req) |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 196 | { |
| 197 | struct request *rsp = req->next_rq; |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 198 | struct bsg_job *job = blk_mq_rq_to_pdu(req); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 199 | int ret; |
| 200 | |
Christoph Hellwig | 31156ec | 2018-03-13 17:28:39 +0100 | [diff] [blame] | 201 | job->timeout = req->timeout; |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 202 | |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 203 | if (req->bio) { |
| 204 | ret = bsg_map_buffer(&job->request_payload, req); |
| 205 | if (ret) |
| 206 | goto failjob_rls_job; |
| 207 | } |
| 208 | if (rsp && rsp->bio) { |
| 209 | ret = bsg_map_buffer(&job->reply_payload, rsp); |
| 210 | if (ret) |
| 211 | goto failjob_rls_rqst_payload; |
| 212 | } |
| 213 | job->dev = dev; |
| 214 | /* take a reference for the request */ |
| 215 | get_device(job->dev); |
Johannes Thumshirn | bf0f2d3 | 2016-11-17 10:31:18 +0100 | [diff] [blame] | 216 | kref_init(&job->kref); |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 217 | return true; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 218 | |
| 219 | failjob_rls_rqst_payload: |
| 220 | kfree(job->request_payload.sg_list); |
| 221 | failjob_rls_job: |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 222 | job->result = -ENOMEM; |
| 223 | return false; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 224 | } |
| 225 | |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 226 | /** |
| 227 | * bsg_request_fn - generic handler for bsg requests |
| 228 | * @q: request queue to manage |
| 229 | * |
| 230 | * On error the create_bsg_job function should return a -Exyz error value |
Christoph Hellwig | 17d5363 | 2017-04-20 16:03:01 +0200 | [diff] [blame] | 231 | * that will be set to ->result. |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 232 | * |
| 233 | * Drivers/subsys should pass this to the queue init function. |
| 234 | */ |
Christoph Hellwig | 8ae94eb | 2017-01-03 15:25:02 +0300 | [diff] [blame] | 235 | static void bsg_request_fn(struct request_queue *q) |
Bart Van Assche | dbb3ab0 | 2016-09-25 19:54:38 -0700 | [diff] [blame] | 236 | __releases(q->queue_lock) |
| 237 | __acquires(q->queue_lock) |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 238 | { |
| 239 | struct device *dev = q->queuedata; |
| 240 | struct request *req; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 241 | int ret; |
| 242 | |
| 243 | if (!get_device(dev)) |
| 244 | return; |
| 245 | |
| 246 | while (1) { |
| 247 | req = blk_fetch_request(q); |
| 248 | if (!req) |
| 249 | break; |
| 250 | spin_unlock_irq(q->queue_lock); |
| 251 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 252 | if (!bsg_prepare_job(dev, req)) { |
Christoph Hellwig | 2a842ac | 2017-06-03 09:38:04 +0200 | [diff] [blame] | 253 | blk_end_request_all(req, BLK_STS_OK); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 254 | spin_lock_irq(q->queue_lock); |
| 255 | continue; |
| 256 | } |
| 257 | |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 258 | ret = q->bsg_job_fn(blk_mq_rq_to_pdu(req)); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 259 | spin_lock_irq(q->queue_lock); |
| 260 | if (ret) |
| 261 | break; |
| 262 | } |
| 263 | |
| 264 | spin_unlock_irq(q->queue_lock); |
| 265 | put_device(dev); |
| 266 | spin_lock_irq(q->queue_lock); |
| 267 | } |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 268 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 269 | /* called right after the request is allocated for the request_queue */ |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 270 | static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp) |
| 271 | { |
| 272 | struct bsg_job *job = blk_mq_rq_to_pdu(req); |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 273 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 274 | job->reply = kzalloc(SCSI_SENSE_BUFFERSIZE, gfp); |
| 275 | if (!job->reply) |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 276 | return -ENOMEM; |
Benjamin Block | eab40cf | 2017-10-03 12:48:37 +0200 | [diff] [blame] | 277 | return 0; |
| 278 | } |
| 279 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 280 | /* called right before the request is given to the request_queue user */ |
Benjamin Block | eab40cf | 2017-10-03 12:48:37 +0200 | [diff] [blame] | 281 | static void bsg_initialize_rq(struct request *req) |
| 282 | { |
| 283 | struct bsg_job *job = blk_mq_rq_to_pdu(req); |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 284 | void *reply = job->reply; |
Benjamin Block | eab40cf | 2017-10-03 12:48:37 +0200 | [diff] [blame] | 285 | |
| 286 | memset(job, 0, sizeof(*job)); |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 287 | job->reply = reply; |
| 288 | job->reply_len = SCSI_SENSE_BUFFERSIZE; |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 289 | job->dd_data = job + 1; |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | static void bsg_exit_rq(struct request_queue *q, struct request *req) |
| 293 | { |
| 294 | struct bsg_job *job = blk_mq_rq_to_pdu(req); |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 295 | |
Christoph Hellwig | 17cb960 | 2018-03-13 17:28:41 +0100 | [diff] [blame] | 296 | kfree(job->reply); |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 297 | } |
| 298 | |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 299 | /** |
| 300 | * bsg_setup_queue - Create and add the bsg hooks so we can receive requests |
| 301 | * @dev: device to attach bsg device to |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 302 | * @name: device to give bsg device |
| 303 | * @job_fn: bsg job handler |
| 304 | * @dd_job_size: size of LLD data needed for each job |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 305 | */ |
Christoph Hellwig | c1225f0 | 2017-08-25 17:37:38 +0200 | [diff] [blame] | 306 | struct request_queue *bsg_setup_queue(struct device *dev, const char *name, |
Christoph Hellwig | 5de815a | 2018-05-29 08:40:23 +0200 | [diff] [blame] | 307 | bsg_job_fn *job_fn, int dd_job_size) |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 308 | { |
Christoph Hellwig | 8ae94eb | 2017-01-03 15:25:02 +0300 | [diff] [blame] | 309 | struct request_queue *q; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 310 | int ret; |
| 311 | |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 312 | q = blk_alloc_queue(GFP_KERNEL); |
Christoph Hellwig | 8ae94eb | 2017-01-03 15:25:02 +0300 | [diff] [blame] | 313 | if (!q) |
| 314 | return ERR_PTR(-ENOMEM); |
Benjamin Block | 50b4d48 | 2017-08-24 01:57:56 +0200 | [diff] [blame] | 315 | q->cmd_size = sizeof(struct bsg_job) + dd_job_size; |
| 316 | q->init_rq_fn = bsg_init_rq; |
| 317 | q->exit_rq_fn = bsg_exit_rq; |
Benjamin Block | eab40cf | 2017-10-03 12:48:37 +0200 | [diff] [blame] | 318 | q->initialize_rq_fn = bsg_initialize_rq; |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 319 | q->request_fn = bsg_request_fn; |
| 320 | |
| 321 | ret = blk_init_allocated_queue(q); |
| 322 | if (ret) |
| 323 | goto out_cleanup_queue; |
Christoph Hellwig | 8ae94eb | 2017-01-03 15:25:02 +0300 | [diff] [blame] | 324 | |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 325 | q->queuedata = dev; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 326 | q->bsg_job_fn = job_fn; |
Bart Van Assche | 8b904b5 | 2018-03-07 17:10:10 -0800 | [diff] [blame] | 327 | blk_queue_flag_set(QUEUE_FLAG_BIDI, q); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 328 | blk_queue_softirq_done(q, bsg_softirq_done); |
| 329 | blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT); |
| 330 | |
Christoph Hellwig | 5de815a | 2018-05-29 08:40:23 +0200 | [diff] [blame] | 331 | ret = bsg_register_queue(q, dev, name, &bsg_transport_ops); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 332 | if (ret) { |
| 333 | printk(KERN_ERR "%s: bsg interface failed to " |
| 334 | "initialize - register queue\n", dev->kobj.name); |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 335 | goto out_cleanup_queue; |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 336 | } |
| 337 | |
Christoph Hellwig | 8ae94eb | 2017-01-03 15:25:02 +0300 | [diff] [blame] | 338 | return q; |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 339 | out_cleanup_queue: |
| 340 | blk_cleanup_queue(q); |
| 341 | return ERR_PTR(ret); |
Mike Christie | aa387cc | 2011-07-31 22:05:09 +0200 | [diff] [blame] | 342 | } |
| 343 | EXPORT_SYMBOL_GPL(bsg_setup_queue); |