Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8c46f85 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: glink_pkt: Remove WARN_ON in glink_pkt_write" into msm-4.9

parents bf32ab56 2212b27c
Loading
Loading
Loading
Loading
+17 −5
Original line number Original line Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -664,8 +664,15 @@ ssize_t glink_pkt_read(struct file *file,
	spin_unlock_irqrestore(&devp->pkt_list_lock, flags);
	spin_unlock_irqrestore(&devp->pkt_list_lock, flags);


	ret = copy_to_user(buf, pkt->data, pkt->size);
	ret = copy_to_user(buf, pkt->data, pkt->size);
	if (WARN_ON(ret != 0))
	if (ret) {
		return ret;
		GLINK_PKT_ERR(
		"%s copy_to_user failed ret[%d] on dev id:%d size %zu\n",
		 __func__, ret, devp->i, pkt->size);
		spin_lock_irqsave(&devp->pkt_list_lock, flags);
		list_add_tail(&pkt->list, &devp->pkt_list);
		spin_unlock_irqrestore(&devp->pkt_list_lock, flags);
		return -EFAULT;
	}


	ret = pkt->size;
	ret = pkt->size;
	glink_rx_done(devp->handle, pkt->data, false);
	glink_rx_done(devp->handle, pkt->data, false);
@@ -739,8 +746,13 @@ ssize_t glink_pkt_write(struct file *file,
	}
	}


	ret = copy_from_user(data, buf, count);
	ret = copy_from_user(data, buf, count);
	if (WARN_ON(ret != 0))
	if (ret) {
		return ret;
		GLINK_PKT_ERR(
		"%s copy_from_user failed ret[%d] on dev id:%d size %zu\n",
		 __func__, ret, devp->i, count);
		kfree(data);
		return -EFAULT;
	}


	ret = glink_tx(devp->handle, data, data, count, GLINK_TX_REQ_INTENT);
	ret = glink_tx(devp->handle, data, data, count, GLINK_TX_REQ_INTENT);
	if (ret) {
	if (ret) {