Revision 2d6c1ef4

b/hw/qdev-properties.c
351 351
    CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
352 352

  
353 353
    *ptr = qemu_chr_find(str);
354
    if (*ptr == NULL)
354
    if (*ptr == NULL) {
355 355
        return -ENOENT;
356
    }
357
    if ((*ptr)->assigned) {
358
        return -EEXIST;
359
    }
360
    (*ptr)->assigned = 1;
356 361
    return 0;
357 362
}
358 363

  
b/qemu-char.c
197 197
                           IOEventHandler *fd_event,
198 198
                           void *opaque)
199 199
{
200
    if (!opaque) {
201
        /* chr driver being released. */
202
        s->assigned = 0;
203
    }
200 204
    s->chr_can_read = fd_can_read;
201 205
    s->chr_read = fd_read;
202 206
    s->chr_event = fd_event;
b/qemu-char.h
70 70
    char *label;
71 71
    char *filename;
72 72
    int opened;
73
    int assigned; /* chardev assigned to a device */
73 74
    QTAILQ_ENTRY(CharDriverState) next;
74 75
};
75 76

  

Also available in: Unified diff