ipc_service: static_vrings: fix num_desc return value
currently when no enough memory is found a (1 << (-1)) value is returned instead of 0. Fix this by returning 0 and simplify log2 computation Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
This commit is contained in:
parent
cb69a0a342
commit
5eaace1c01
1 changed files with 2 additions and 1 deletions
|
@ -163,5 +163,6 @@ static inline unsigned int optimal_num_desc(size_t mem_size, unsigned int buf_si
|
||||||
num_desc++;
|
num_desc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1 << (find_msb_set(--num_desc) - 1));
|
/* if num_desc == 1 there is not enough memory */
|
||||||
|
return (--num_desc == 0) ? 0 : (1 << LOG2(num_desc));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue