diff options
Diffstat (limited to 'drivers/misc/mei/main.c')
| -rw-r--r-- | drivers/misc/mei/main.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index ae56ba6ca0e3..3c019c0e60eb 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
| @@ -303,7 +303,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
| 303 | size_t length, loff_t *offset) | 303 | size_t length, loff_t *offset) |
| 304 | { | 304 | { |
| 305 | struct mei_cl *cl = file->private_data; | 305 | struct mei_cl *cl = file->private_data; |
| 306 | struct mei_me_client *me_cl; | 306 | struct mei_me_client *me_cl = NULL; |
| 307 | struct mei_cl_cb *write_cb = NULL; | 307 | struct mei_cl_cb *write_cb = NULL; |
| 308 | struct mei_device *dev; | 308 | struct mei_device *dev; |
| 309 | unsigned long timeout = 0; | 309 | unsigned long timeout = 0; |
| @@ -399,12 +399,14 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
| 399 | "amthif write failed with status = %d\n", rets); | 399 | "amthif write failed with status = %d\n", rets); |
| 400 | goto out; | 400 | goto out; |
| 401 | } | 401 | } |
| 402 | mei_me_cl_put(me_cl); | ||
| 402 | mutex_unlock(&dev->device_lock); | 403 | mutex_unlock(&dev->device_lock); |
| 403 | return length; | 404 | return length; |
| 404 | } | 405 | } |
| 405 | 406 | ||
| 406 | rets = mei_cl_write(cl, write_cb, false); | 407 | rets = mei_cl_write(cl, write_cb, false); |
| 407 | out: | 408 | out: |
| 409 | mei_me_cl_put(me_cl); | ||
| 408 | mutex_unlock(&dev->device_lock); | 410 | mutex_unlock(&dev->device_lock); |
| 409 | if (rets < 0) | 411 | if (rets < 0) |
| 410 | mei_io_cb_free(write_cb); | 412 | mei_io_cb_free(write_cb); |
| @@ -433,24 +435,19 @@ static int mei_ioctl_connect_client(struct file *file, | |||
| 433 | cl = file->private_data; | 435 | cl = file->private_data; |
| 434 | dev = cl->dev; | 436 | dev = cl->dev; |
| 435 | 437 | ||
| 436 | if (dev->dev_state != MEI_DEV_ENABLED) { | 438 | if (dev->dev_state != MEI_DEV_ENABLED) |
| 437 | rets = -ENODEV; | 439 | return -ENODEV; |
| 438 | goto end; | ||
| 439 | } | ||
| 440 | 440 | ||
| 441 | if (cl->state != MEI_FILE_INITIALIZING && | 441 | if (cl->state != MEI_FILE_INITIALIZING && |
| 442 | cl->state != MEI_FILE_DISCONNECTED) { | 442 | cl->state != MEI_FILE_DISCONNECTED) |
| 443 | rets = -EBUSY; | 443 | return -EBUSY; |
| 444 | goto end; | ||
| 445 | } | ||
| 446 | 444 | ||
| 447 | /* find ME client we're trying to connect to */ | 445 | /* find ME client we're trying to connect to */ |
| 448 | me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid); | 446 | me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid); |
| 449 | if (!me_cl || me_cl->props.fixed_address) { | 447 | if (!me_cl || me_cl->props.fixed_address) { |
| 450 | dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n", | 448 | dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n", |
| 451 | &data->in_client_uuid); | 449 | &data->in_client_uuid); |
| 452 | rets = -ENOTTY; | 450 | return -ENOTTY; |
| 453 | goto end; | ||
| 454 | } | 451 | } |
| 455 | 452 | ||
| 456 | cl->me_client_id = me_cl->client_id; | 453 | cl->me_client_id = me_cl->client_id; |
| @@ -487,17 +484,16 @@ static int mei_ioctl_connect_client(struct file *file, | |||
| 487 | goto end; | 484 | goto end; |
| 488 | } | 485 | } |
| 489 | 486 | ||
| 490 | |||
| 491 | /* prepare the output buffer */ | 487 | /* prepare the output buffer */ |
| 492 | client = &data->out_client_properties; | 488 | client = &data->out_client_properties; |
| 493 | client->max_msg_length = me_cl->props.max_msg_length; | 489 | client->max_msg_length = me_cl->props.max_msg_length; |
| 494 | client->protocol_version = me_cl->props.protocol_version; | 490 | client->protocol_version = me_cl->props.protocol_version; |
| 495 | dev_dbg(dev->dev, "Can connect?\n"); | 491 | dev_dbg(dev->dev, "Can connect?\n"); |
| 496 | 492 | ||
| 497 | |||
| 498 | rets = mei_cl_connect(cl, file); | 493 | rets = mei_cl_connect(cl, file); |
| 499 | 494 | ||
| 500 | end: | 495 | end: |
| 496 | mei_me_cl_put(me_cl); | ||
| 501 | return rets; | 497 | return rets; |
| 502 | } | 498 | } |
| 503 | 499 | ||
