diff options
Diffstat (limited to 'drivers/misc/mei')
-rw-r--r-- | drivers/misc/mei/nfc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c index 3095fc514a65..5ccc23bc7690 100644 --- a/drivers/misc/mei/nfc.c +++ b/drivers/misc/mei/nfc.c | |||
@@ -342,9 +342,10 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) | |||
342 | ndev = (struct mei_nfc_dev *) cldev->priv_data; | 342 | ndev = (struct mei_nfc_dev *) cldev->priv_data; |
343 | dev = ndev->cl->dev; | 343 | dev = ndev->cl->dev; |
344 | 344 | ||
345 | err = -ENOMEM; | ||
345 | mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL); | 346 | mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL); |
346 | if (!mei_buf) | 347 | if (!mei_buf) |
347 | return -ENOMEM; | 348 | goto out; |
348 | 349 | ||
349 | hdr = (struct mei_nfc_hci_hdr *) mei_buf; | 350 | hdr = (struct mei_nfc_hci_hdr *) mei_buf; |
350 | hdr->cmd = MEI_NFC_CMD_HCI_SEND; | 351 | hdr->cmd = MEI_NFC_CMD_HCI_SEND; |
@@ -354,12 +355,9 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) | |||
354 | hdr->data_size = length; | 355 | hdr->data_size = length; |
355 | 356 | ||
356 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); | 357 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); |
357 | |||
358 | err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE); | 358 | err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE); |
359 | if (err < 0) | 359 | if (err < 0) |
360 | return err; | 360 | goto out; |
361 | |||
362 | kfree(mei_buf); | ||
363 | 361 | ||
364 | if (!wait_event_interruptible_timeout(ndev->send_wq, | 362 | if (!wait_event_interruptible_timeout(ndev->send_wq, |
365 | ndev->recv_req_id == ndev->req_id, HZ)) { | 363 | ndev->recv_req_id == ndev->req_id, HZ)) { |
@@ -368,7 +366,8 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) | |||
368 | } else { | 366 | } else { |
369 | ndev->req_id++; | 367 | ndev->req_id++; |
370 | } | 368 | } |
371 | 369 | out: | |
370 | kfree(mei_buf); | ||
372 | return err; | 371 | return err; |
373 | } | 372 | } |
374 | 373 | ||