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.

Change-Id: I75bc136eab05151abb187c1fa1e5956b6f507297
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This commit is contained in:
Vijayavardhan Vennapusa 2016-01-28 11:48:44 -08:00 committed by David Keitel
parent 32abf3b67f
commit 9d89a6599d

View file

@ -889,11 +889,22 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
ret = -ENODEV;
spin_unlock_irq(&epfile->ffs->eps_lock);
if (io_data->read && ret > 0) {
if (ret > data_len) {
ret = -EOVERFLOW;
pr_err("More data(%zd) received than intended length(%zu)\n",
ret, data_len);
} else {
ret = copy_to_iter(data, ret, &io_data->data);
if (!ret)
pr_debug("copied (%zd) bytes to user space\n", ret);
if (!ret) {
pr_err("Fail to copy to user\n");
ret = -EFAULT;
}
}
}
}
kfree(data);
}
}