spcom: print error message on lock ion failure
Locking ION buffer should not fail, print error message if it happens. Signed-off-by: Amir Samuelov <amirs@codeaurora.org> Change-Id: Ic67f69daa646712dd814f29d5aa0fc68386177e1
This commit is contained in:
parent
2e47ba9a64
commit
edd2fc9348
1 changed files with 16 additions and 4 deletions
|
@ -316,6 +316,10 @@ static int spcom_create_predefined_channels_chardev(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
static bool is_predefined_created;
|
||||||
|
|
||||||
|
if (is_predefined_created)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < SPCOM_MAX_CHANNELS; i++) {
|
for (i = 0; i < SPCOM_MAX_CHANNELS; i++) {
|
||||||
const char *name = spcom_dev->predefined_ch_name[i];
|
const char *name = spcom_dev->predefined_ch_name[i];
|
||||||
|
@ -330,6 +334,8 @@ static int spcom_create_predefined_channels_chardev(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_predefined_created = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1633,12 +1639,13 @@ static int spcom_handle_lock_ion_buf_command(struct spcom_channel *ch,
|
||||||
pr_err("fail to get ion handle.\n");
|
pr_err("fail to get ion handle.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("ion handle ok.\n");
|
pr_debug("ion handle ok.\n");
|
||||||
|
|
||||||
/* Check if this ION buffer is already locked */
|
/* Check if this ION buffer is already locked */
|
||||||
for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
|
for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
|
||||||
if (ch->ion_handle_table[i] == ion_handle) {
|
if (ch->ion_handle_table[i] == ion_handle) {
|
||||||
pr_debug("fd [%d] ion buf is already locked.\n", fd);
|
pr_err("fd [%d] ion buf is already locked.\n", fd);
|
||||||
/* decrement back the ref count */
|
/* decrement back the ref count */
|
||||||
ion_free(spcom_dev->ion_client, ion_handle);
|
ion_free(spcom_dev->ion_client, ion_handle);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1650,11 +1657,14 @@ static int spcom_handle_lock_ion_buf_command(struct spcom_channel *ch,
|
||||||
if (ch->ion_handle_table[i] == NULL) {
|
if (ch->ion_handle_table[i] == NULL) {
|
||||||
ch->ion_handle_table[i] = ion_handle;
|
ch->ion_handle_table[i] = ion_handle;
|
||||||
ch->ion_fd_table[i] = fd;
|
ch->ion_fd_table[i] = fd;
|
||||||
pr_debug("locked ion buf#[%d], fd [%d].\n", i, fd);
|
pr_debug("ch [%s] locked ion buf #%d, fd [%d].\n",
|
||||||
|
ch->name, i, fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pr_err("fd [%d] ion buf not found.\n", fd);
|
||||||
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1684,20 +1694,22 @@ static int spcom_unlock_ion_buf(struct spcom_channel *ch, int fd)
|
||||||
/* unlock all ION buf */
|
/* unlock all ION buf */
|
||||||
for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
|
for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
|
||||||
if (ch->ion_handle_table[i] != NULL) {
|
if (ch->ion_handle_table[i] != NULL) {
|
||||||
|
pr_debug("unlocked ion buf #%d fd [%d].\n",
|
||||||
|
i, ch->ion_fd_table[i]);
|
||||||
ion_free(ion_client, ch->ion_handle_table[i]);
|
ion_free(ion_client, ch->ion_handle_table[i]);
|
||||||
ch->ion_handle_table[i] = NULL;
|
ch->ion_handle_table[i] = NULL;
|
||||||
ch->ion_fd_table[i] = -1;
|
ch->ion_fd_table[i] = -1;
|
||||||
pr_debug("unlocked ion buf#[%d].\n", i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* unlock specific ION buf */
|
/* unlock specific ION buf */
|
||||||
for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
|
for (i = 0 ; i < ARRAY_SIZE(ch->ion_handle_table) ; i++) {
|
||||||
if (ch->ion_fd_table[i] == fd) {
|
if (ch->ion_fd_table[i] == fd) {
|
||||||
|
pr_debug("unlocked ion buf #%d fd [%d].\n",
|
||||||
|
i, ch->ion_fd_table[i]);
|
||||||
ion_free(ion_client, ch->ion_handle_table[i]);
|
ion_free(ion_client, ch->ion_handle_table[i]);
|
||||||
ch->ion_handle_table[i] = NULL;
|
ch->ion_handle_table[i] = NULL;
|
||||||
ch->ion_fd_table[i] = -1;
|
ch->ion_fd_table[i] = -1;
|
||||||
pr_debug("unlocked ion buf#[%d].\n", i);
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue