device->dt_data = kmalloc(sizeof(device->dt->priv_data_size), GFP_KERNEL);
device->dt_data = kmalloc(device->dt->priv_data_size, GFP_KERNEL);
static int tgt_device_create(int tid, uint64_t dev_id, char *device_type,			      char *path, unsigned long dflags){	struct tgt_target *target;	struct tgt_device *device;	unsigned long flags;	dprintk("%d %llu %s %s\n", tid, dev_id, device_type, path);	target = target_find(tid);	if (!target)		return -EINVAL;	device = kmalloc(sizeof(*device), GFP_KERNEL);	if (!device)		return -ENOMEM;	memset(device, 0, sizeof(*device));	device->dev_id = dev_id;	device->target = target;	device->path = kstrdup(path, GFP_KERNEL);	if (!device->path)		goto free_device;	device->dt = device_template_get(device_type);	if (!device->dt) {		eprintk("Could not get devive type %s\n", device_type);		goto free_path;	}	device->dt_data = kmalloc(sizeof(device->dt->priv_data_size),				   GFP_KERNEL);	if (!device->dt_data)		goto put_template;	if (device->dt->create)		if (device->dt->create(device))			goto free_priv_dt_data;	if (tgt_sysfs_register_device(device))		goto dt_destroy;	spin_lock_irqsave(&target->lock, flags);	list_add(&device->dlist, &target->device_list);	spin_unlock_irqrestore(&target->lock, flags);	return 0;dt_destroy:	if (device->dt->destroy)		device->dt->destroy(device);free_priv_dt_data:	kfree(device->dt_data);put_template:	device_template_put(device->dt);free_path:	kfree(device->path);free_device:	kfree(device);	return -EINVAL;}