msm: qti_sdio_client: Return error number in diag callback
Return error number in the diag callback to handle it in calback's error handling sequence. This potentially fixes a memory leak when device is reenumerated multiple times such as during SSR. Change-Id: I841d07dfa2f3231e54c5145f27dda977fa8c9f97 Signed-off-by: Amandeep Singh <amansing@codeaurora.org>
This commit is contained in:
parent
e53bd39000
commit
a08ceb359a
1 changed files with 14 additions and 9 deletions
|
@ -88,9 +88,9 @@ static DEFINE_MUTEX(work_lock);
|
||||||
static spinlock_t list_lock;
|
static spinlock_t list_lock;
|
||||||
|
|
||||||
#define qlog(qsb, _msg, ...) do { \
|
#define qlog(qsb, _msg, ...) do { \
|
||||||
if (to_console) \
|
if (!qsb ? 1 : to_console) \
|
||||||
pr_err("[%s] " _msg, __func__, ##__VA_ARGS__); \
|
pr_err("[%s] " _msg, __func__, ##__VA_ARGS__); \
|
||||||
if (ipc_log) \
|
if (qsb && ipc_log) \
|
||||||
ipc_log_string(qsb->ipc_log_ctxt, "[%s] " _msg, __func__, \
|
ipc_log_string(qsb->ipc_log_ctxt, "[%s] " _msg, __func__, \
|
||||||
##__VA_ARGS__); \
|
##__VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -438,8 +438,10 @@ int qti_client_read(int id, char *buf, size_t count)
|
||||||
|
|
||||||
wait_event(qsb->wait_q, qsb->data_avail ||
|
wait_event(qsb->wait_q, qsb->data_avail ||
|
||||||
atomic_read(&qsb->is_client_closing));
|
atomic_read(&qsb->is_client_closing));
|
||||||
if (atomic_read(&qsb->is_client_closing))
|
if (atomic_read(&qsb->is_client_closing)) {
|
||||||
return count;
|
ret = -ENODEV;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
bytes = qsb->data_avail;
|
bytes = qsb->data_avail;
|
||||||
|
|
||||||
|
@ -484,7 +486,7 @@ out:
|
||||||
if (id == QCN_SDIO_CLI_ID_DIAG && qsb->ops &&
|
if (id == QCN_SDIO_CLI_ID_DIAG && qsb->ops &&
|
||||||
qsb->ops->read_complete_cb) {
|
qsb->ops->read_complete_cb) {
|
||||||
qsb->ops->read_complete_cb((void *)(uintptr_t)0, buf, count,
|
qsb->ops->read_complete_cb((void *)(uintptr_t)0, buf, count,
|
||||||
count);
|
ret < 0 ? ret : count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qsb->data_remain) {
|
if (!qsb->data_remain) {
|
||||||
|
@ -593,8 +595,10 @@ int qti_client_write(int id, char *buf, size_t count)
|
||||||
|
|
||||||
wait_event(qsb->wait_q, qsb->tx_ready ||
|
wait_event(qsb->wait_q, qsb->tx_ready ||
|
||||||
atomic_read(&qsb->is_client_closing));
|
atomic_read(&qsb->is_client_closing));
|
||||||
if (atomic_read(&qsb->is_client_closing))
|
if (atomic_read(&qsb->is_client_closing)) {
|
||||||
return count;
|
ret = -ENODEV;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (qsb->mode) {
|
if (qsb->mode) {
|
||||||
reinit_completion(&tx_complete);
|
reinit_completion(&tx_complete);
|
||||||
|
@ -627,10 +631,11 @@ int qti_client_write(int id, char *buf, size_t count)
|
||||||
buffer = buffer + temp_count;
|
buffer = buffer + temp_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
if (id == QCN_SDIO_CLI_ID_DIAG && qsb->ops &&
|
if (id == QCN_SDIO_CLI_ID_DIAG && qsb->ops &&
|
||||||
qsb->ops->write_complete_cb) {
|
qsb->ops->write_complete_cb) {
|
||||||
qsb->ops->write_complete_cb((void *)(uintptr_t)0, buf, count,
|
qsb->ops->write_complete_cb((void *)(uintptr_t)0, buf, count,
|
||||||
count);
|
ret < 0 ? ret : count);
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Add table
Reference in a new issue