Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Kernel/userspace transport abstraction for Hyper-V util driver. |
| 3 | * |
| 4 | * Copyright (C) 2015, Vitaly Kuznetsov <vkuznets@redhat.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License version 2 as published |
| 8 | * by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more |
| 14 | * details. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #include <linux/slab.h> |
| 19 | #include <linux/fs.h> |
| 20 | #include <linux/poll.h> |
| 21 | |
| 22 | #include "hyperv_vmbus.h" |
| 23 | #include "hv_utils_transport.h" |
| 24 | |
| 25 | static DEFINE_SPINLOCK(hvt_list_lock); |
| 26 | static struct list_head hvt_list = LIST_HEAD_INIT(hvt_list); |
| 27 | |
| 28 | static void hvt_reset(struct hvutil_transport *hvt) |
| 29 | { |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 30 | kfree(hvt->outmsg); |
| 31 | hvt->outmsg = NULL; |
| 32 | hvt->outmsg_len = 0; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 33 | if (hvt->on_reset) |
| 34 | hvt->on_reset(); |
| 35 | } |
| 36 | |
| 37 | static ssize_t hvt_op_read(struct file *file, char __user *buf, |
| 38 | size_t count, loff_t *ppos) |
| 39 | { |
| 40 | struct hvutil_transport *hvt; |
| 41 | int ret; |
| 42 | |
| 43 | hvt = container_of(file->f_op, struct hvutil_transport, fops); |
| 44 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 45 | if (wait_event_interruptible(hvt->outmsg_q, hvt->outmsg_len > 0 || |
| 46 | hvt->mode != HVUTIL_TRANSPORT_CHARDEV)) |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 47 | return -EINTR; |
| 48 | |
Vitaly Kuznetsov | a72f3a4 | 2015-12-14 19:01:54 -0800 | [diff] [blame] | 49 | mutex_lock(&hvt->lock); |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 50 | |
| 51 | if (hvt->mode == HVUTIL_TRANSPORT_DESTROY) { |
| 52 | ret = -EBADF; |
| 53 | goto out_unlock; |
| 54 | } |
| 55 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 56 | if (!hvt->outmsg) { |
| 57 | ret = -EAGAIN; |
| 58 | goto out_unlock; |
| 59 | } |
| 60 | |
| 61 | if (count < hvt->outmsg_len) { |
| 62 | ret = -EINVAL; |
| 63 | goto out_unlock; |
| 64 | } |
| 65 | |
| 66 | if (!copy_to_user(buf, hvt->outmsg, hvt->outmsg_len)) |
| 67 | ret = hvt->outmsg_len; |
| 68 | else |
| 69 | ret = -EFAULT; |
| 70 | |
| 71 | kfree(hvt->outmsg); |
| 72 | hvt->outmsg = NULL; |
| 73 | hvt->outmsg_len = 0; |
| 74 | |
Vitaly Kuznetsov | e0fa3e5 | 2016-06-09 17:08:57 -0700 | [diff] [blame] | 75 | if (hvt->on_read) |
| 76 | hvt->on_read(); |
| 77 | hvt->on_read = NULL; |
| 78 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 79 | out_unlock: |
Vitaly Kuznetsov | a72f3a4 | 2015-12-14 19:01:54 -0800 | [diff] [blame] | 80 | mutex_unlock(&hvt->lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 81 | return ret; |
| 82 | } |
| 83 | |
| 84 | static ssize_t hvt_op_write(struct file *file, const char __user *buf, |
| 85 | size_t count, loff_t *ppos) |
| 86 | { |
| 87 | struct hvutil_transport *hvt; |
| 88 | u8 *inmsg; |
Vitaly Kuznetsov | 1f75338 | 2015-12-14 19:01:53 -0800 | [diff] [blame] | 89 | int ret; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 90 | |
| 91 | hvt = container_of(file->f_op, struct hvutil_transport, fops); |
| 92 | |
Olaf Hering | b003596 | 2015-12-14 16:01:37 -0800 | [diff] [blame] | 93 | inmsg = memdup_user(buf, count); |
| 94 | if (IS_ERR(inmsg)) |
| 95 | return PTR_ERR(inmsg); |
| 96 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 97 | if (hvt->mode == HVUTIL_TRANSPORT_DESTROY) |
| 98 | ret = -EBADF; |
| 99 | else |
| 100 | ret = hvt->on_msg(inmsg, count); |
Vitaly Kuznetsov | 1f75338 | 2015-12-14 19:01:53 -0800 | [diff] [blame] | 101 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 102 | kfree(inmsg); |
| 103 | |
Vitaly Kuznetsov | 1f75338 | 2015-12-14 19:01:53 -0800 | [diff] [blame] | 104 | return ret ? ret : count; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | static unsigned int hvt_op_poll(struct file *file, poll_table *wait) |
| 108 | { |
| 109 | struct hvutil_transport *hvt; |
| 110 | |
| 111 | hvt = container_of(file->f_op, struct hvutil_transport, fops); |
| 112 | |
| 113 | poll_wait(file, &hvt->outmsg_q, wait); |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 114 | |
| 115 | if (hvt->mode == HVUTIL_TRANSPORT_DESTROY) |
Vitaly Kuznetsov | 77b744a | 2015-12-15 16:27:26 -0800 | [diff] [blame] | 116 | return POLLERR | POLLHUP; |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 117 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 118 | if (hvt->outmsg_len > 0) |
| 119 | return POLLIN | POLLRDNORM; |
| 120 | |
| 121 | return 0; |
| 122 | } |
| 123 | |
| 124 | static int hvt_op_open(struct inode *inode, struct file *file) |
| 125 | { |
| 126 | struct hvutil_transport *hvt; |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 127 | int ret = 0; |
| 128 | bool issue_reset = false; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 129 | |
| 130 | hvt = container_of(file->f_op, struct hvutil_transport, fops); |
| 131 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 132 | mutex_lock(&hvt->lock); |
| 133 | |
| 134 | if (hvt->mode == HVUTIL_TRANSPORT_DESTROY) { |
| 135 | ret = -EBADF; |
| 136 | } else if (hvt->mode == HVUTIL_TRANSPORT_INIT) { |
| 137 | /* |
| 138 | * Switching to CHARDEV mode. We switch bach to INIT when |
| 139 | * device gets released. |
| 140 | */ |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 141 | hvt->mode = HVUTIL_TRANSPORT_CHARDEV; |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 142 | } |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 143 | else if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) { |
| 144 | /* |
| 145 | * We're switching from netlink communication to using char |
| 146 | * device. Issue the reset first. |
| 147 | */ |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 148 | issue_reset = true; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 149 | hvt->mode = HVUTIL_TRANSPORT_CHARDEV; |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 150 | } else { |
| 151 | ret = -EBUSY; |
| 152 | } |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 153 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 154 | if (issue_reset) |
| 155 | hvt_reset(hvt); |
| 156 | |
| 157 | mutex_unlock(&hvt->lock); |
| 158 | |
| 159 | return ret; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 160 | } |
| 161 | |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 162 | static void hvt_transport_free(struct hvutil_transport *hvt) |
| 163 | { |
| 164 | misc_deregister(&hvt->mdev); |
| 165 | kfree(hvt->outmsg); |
| 166 | kfree(hvt); |
| 167 | } |
| 168 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 169 | static int hvt_op_release(struct inode *inode, struct file *file) |
| 170 | { |
| 171 | struct hvutil_transport *hvt; |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 172 | int mode_old; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 173 | |
| 174 | hvt = container_of(file->f_op, struct hvutil_transport, fops); |
| 175 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 176 | mutex_lock(&hvt->lock); |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 177 | mode_old = hvt->mode; |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 178 | if (hvt->mode != HVUTIL_TRANSPORT_DESTROY) |
| 179 | hvt->mode = HVUTIL_TRANSPORT_INIT; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 180 | /* |
| 181 | * Cleanup message buffers to avoid spurious messages when the daemon |
| 182 | * connects back. |
| 183 | */ |
| 184 | hvt_reset(hvt); |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 185 | mutex_unlock(&hvt->lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 186 | |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 187 | if (mode_old == HVUTIL_TRANSPORT_DESTROY) |
| 188 | hvt_transport_free(hvt); |
| 189 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 190 | return 0; |
| 191 | } |
| 192 | |
| 193 | static void hvt_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) |
| 194 | { |
| 195 | struct hvutil_transport *hvt, *hvt_found = NULL; |
| 196 | |
| 197 | spin_lock(&hvt_list_lock); |
| 198 | list_for_each_entry(hvt, &hvt_list, list) { |
| 199 | if (hvt->cn_id.idx == msg->id.idx && |
| 200 | hvt->cn_id.val == msg->id.val) { |
| 201 | hvt_found = hvt; |
| 202 | break; |
| 203 | } |
| 204 | } |
| 205 | spin_unlock(&hvt_list_lock); |
| 206 | if (!hvt_found) { |
| 207 | pr_warn("hvt_cn_callback: spurious message received!\n"); |
| 208 | return; |
| 209 | } |
| 210 | |
| 211 | /* |
| 212 | * Switching to NETLINK mode. Switching to CHARDEV happens when someone |
| 213 | * opens the device. |
| 214 | */ |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 215 | mutex_lock(&hvt->lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 216 | if (hvt->mode == HVUTIL_TRANSPORT_INIT) |
| 217 | hvt->mode = HVUTIL_TRANSPORT_NETLINK; |
| 218 | |
| 219 | if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) |
| 220 | hvt_found->on_msg(msg->data, msg->len); |
| 221 | else |
| 222 | pr_warn("hvt_cn_callback: unexpected netlink message!\n"); |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 223 | mutex_unlock(&hvt->lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 224 | } |
| 225 | |
Vitaly Kuznetsov | e0fa3e5 | 2016-06-09 17:08:57 -0700 | [diff] [blame] | 226 | int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len, |
| 227 | void (*on_read_cb)(void)) |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 228 | { |
| 229 | struct cn_msg *cn_msg; |
| 230 | int ret = 0; |
| 231 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 232 | if (hvt->mode == HVUTIL_TRANSPORT_INIT || |
| 233 | hvt->mode == HVUTIL_TRANSPORT_DESTROY) { |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 234 | return -EINVAL; |
| 235 | } else if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) { |
| 236 | cn_msg = kzalloc(sizeof(*cn_msg) + len, GFP_ATOMIC); |
Dan Carpenter | 9dd6a06 | 2015-08-01 16:08:17 -0700 | [diff] [blame] | 237 | if (!cn_msg) |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 238 | return -ENOMEM; |
| 239 | cn_msg->id.idx = hvt->cn_id.idx; |
| 240 | cn_msg->id.val = hvt->cn_id.val; |
| 241 | cn_msg->len = len; |
| 242 | memcpy(cn_msg->data, msg, len); |
| 243 | ret = cn_netlink_send(cn_msg, 0, 0, GFP_ATOMIC); |
| 244 | kfree(cn_msg); |
Vitaly Kuznetsov | e0fa3e5 | 2016-06-09 17:08:57 -0700 | [diff] [blame] | 245 | /* |
| 246 | * We don't know when netlink messages are delivered but unlike |
| 247 | * in CHARDEV mode we're not blocked and we can send next |
| 248 | * messages right away. |
| 249 | */ |
| 250 | if (on_read_cb) |
| 251 | on_read_cb(); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 252 | return ret; |
| 253 | } |
| 254 | /* HVUTIL_TRANSPORT_CHARDEV */ |
Vitaly Kuznetsov | a72f3a4 | 2015-12-14 19:01:54 -0800 | [diff] [blame] | 255 | mutex_lock(&hvt->lock); |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 256 | if (hvt->mode != HVUTIL_TRANSPORT_CHARDEV) { |
| 257 | ret = -EINVAL; |
| 258 | goto out_unlock; |
| 259 | } |
| 260 | |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 261 | if (hvt->outmsg) { |
| 262 | /* Previous message wasn't received */ |
| 263 | ret = -EFAULT; |
| 264 | goto out_unlock; |
| 265 | } |
| 266 | hvt->outmsg = kzalloc(len, GFP_KERNEL); |
Olaf Hering | cdc0c0c | 2015-12-14 16:01:36 -0800 | [diff] [blame] | 267 | if (hvt->outmsg) { |
| 268 | memcpy(hvt->outmsg, msg, len); |
| 269 | hvt->outmsg_len = len; |
Vitaly Kuznetsov | e0fa3e5 | 2016-06-09 17:08:57 -0700 | [diff] [blame] | 270 | hvt->on_read = on_read_cb; |
Olaf Hering | cdc0c0c | 2015-12-14 16:01:36 -0800 | [diff] [blame] | 271 | wake_up_interruptible(&hvt->outmsg_q); |
| 272 | } else |
| 273 | ret = -ENOMEM; |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 274 | out_unlock: |
Vitaly Kuznetsov | a72f3a4 | 2015-12-14 19:01:54 -0800 | [diff] [blame] | 275 | mutex_unlock(&hvt->lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 276 | return ret; |
| 277 | } |
| 278 | |
| 279 | struct hvutil_transport *hvutil_transport_init(const char *name, |
| 280 | u32 cn_idx, u32 cn_val, |
| 281 | int (*on_msg)(void *, int), |
| 282 | void (*on_reset)(void)) |
| 283 | { |
| 284 | struct hvutil_transport *hvt; |
| 285 | |
| 286 | hvt = kzalloc(sizeof(*hvt), GFP_KERNEL); |
| 287 | if (!hvt) |
| 288 | return NULL; |
| 289 | |
| 290 | hvt->cn_id.idx = cn_idx; |
| 291 | hvt->cn_id.val = cn_val; |
| 292 | |
| 293 | hvt->mdev.minor = MISC_DYNAMIC_MINOR; |
| 294 | hvt->mdev.name = name; |
| 295 | |
| 296 | hvt->fops.owner = THIS_MODULE; |
| 297 | hvt->fops.read = hvt_op_read; |
| 298 | hvt->fops.write = hvt_op_write; |
| 299 | hvt->fops.poll = hvt_op_poll; |
| 300 | hvt->fops.open = hvt_op_open; |
| 301 | hvt->fops.release = hvt_op_release; |
| 302 | |
| 303 | hvt->mdev.fops = &hvt->fops; |
| 304 | |
| 305 | init_waitqueue_head(&hvt->outmsg_q); |
Vitaly Kuznetsov | a72f3a4 | 2015-12-14 19:01:54 -0800 | [diff] [blame] | 306 | mutex_init(&hvt->lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 307 | |
| 308 | spin_lock(&hvt_list_lock); |
| 309 | list_add(&hvt->list, &hvt_list); |
| 310 | spin_unlock(&hvt_list_lock); |
| 311 | |
| 312 | hvt->on_msg = on_msg; |
| 313 | hvt->on_reset = on_reset; |
| 314 | |
| 315 | if (misc_register(&hvt->mdev)) |
| 316 | goto err_free_hvt; |
| 317 | |
| 318 | /* Use cn_id.idx/cn_id.val to determine if we need to setup netlink */ |
| 319 | if (hvt->cn_id.idx > 0 && hvt->cn_id.val > 0 && |
| 320 | cn_add_callback(&hvt->cn_id, name, hvt_cn_callback)) |
| 321 | goto err_free_hvt; |
| 322 | |
| 323 | return hvt; |
| 324 | |
| 325 | err_free_hvt: |
Alex Ng | e66853b | 2016-02-26 15:13:20 -0800 | [diff] [blame] | 326 | spin_lock(&hvt_list_lock); |
| 327 | list_del(&hvt->list); |
| 328 | spin_unlock(&hvt_list_lock); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 329 | kfree(hvt); |
| 330 | return NULL; |
| 331 | } |
| 332 | |
| 333 | void hvutil_transport_destroy(struct hvutil_transport *hvt) |
| 334 | { |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 335 | int mode_old; |
| 336 | |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 337 | mutex_lock(&hvt->lock); |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 338 | mode_old = hvt->mode; |
Vitaly Kuznetsov | a150256 | 2015-12-14 19:01:55 -0800 | [diff] [blame] | 339 | hvt->mode = HVUTIL_TRANSPORT_DESTROY; |
| 340 | wake_up_interruptible(&hvt->outmsg_q); |
| 341 | mutex_unlock(&hvt->lock); |
| 342 | |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 343 | /* |
| 344 | * In case we were in 'chardev' mode we still have an open fd so we |
| 345 | * have to defer freeing the device. Netlink interface can be freed |
| 346 | * now. |
| 347 | */ |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 348 | spin_lock(&hvt_list_lock); |
| 349 | list_del(&hvt->list); |
| 350 | spin_unlock(&hvt_list_lock); |
| 351 | if (hvt->cn_id.idx > 0 && hvt->cn_id.val > 0) |
| 352 | cn_del_callback(&hvt->cn_id); |
Vitaly Kuznetsov | 9420098 | 2015-12-14 19:01:56 -0800 | [diff] [blame] | 353 | |
| 354 | if (mode_old != HVUTIL_TRANSPORT_CHARDEV) |
| 355 | hvt_transport_free(hvt); |
Vitaly Kuznetsov | 14b50f8 | 2015-04-11 18:07:51 -0700 | [diff] [blame] | 356 | } |