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

Commit 5414cade authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Matt Wagantall
Browse files

USB: f_fs: Add print message in case of error scenario



Add print message in case of error scenarios which will
be useful for debugging adb offline issues.

CRs-Fixed: 720016
Change-Id: I75bc136eab05151abb187c1fa1e5956b6f507297
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarJack Pham <jackp@codeauorora.org>
parent fd8c1eba
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -693,6 +693,7 @@ static void ffs_epfile_async_io_complete(struct usb_ep *_ep,
	schedule_work(&io_data->work);
}

#define MAX_BUF_LEN	4096
static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
{
	struct ffs_epfile *epfile = file->private_data;
@@ -868,13 +869,24 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
				 */
				ret = ep->status;
				if (io_data->read && ret > 0) {
					if (io_data->len != MAX_BUF_LEN &&
							ret < io_data->len)
						pr_err("less data(%zd) recieved than intended length(%zu)\n",
							ret, io_data->len);
					else if (ret > io_data->len)
						pr_err("More data(%zd) recieved than intended length(%zu)\n",
							ret, io_data->len);

					ret = min_t(size_t, ret, io_data->len);

					if (unlikely(copy_to_user(io_data->buf,
						data, ret)))
						data, ret))) {
						pr_err("Fail to copy to user len:%zd\n",
								ret);
						ret = -EFAULT;
					}
				}
			}
			kfree(data);
		}
	}
@@ -887,6 +899,8 @@ error_lock:
	mutex_unlock(&epfile->mutex);
error:
	kfree(data);
	if (ret < 0)
		pr_err_ratelimited("Error: returning %zd value\n", ret);
	return ret;
}