ANDROID: dma-buf: Fix error path on system heaps use of the page pool
Daniel Mentz relayed to me that Janghyuck Kim noted that
dma_buf_page_pool_create() returns NULL on error, so the
IS_ERR() check on the return value will never be true.
This patch fixes up the checking so we look for NULL instead and
properly return ENOMEM in that case.
Cc: Daniel Mentz <danielmentz@google.com>
Reported-by: Janghyuck Kim <janghyuck.kim@samsung.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Fixes: 23762f02e1
("ANDROID: dma-buf: system_heap: Add pagepool support to system heap")
Change-Id: Ia428e262cda5cc6bd39a3fbcddade7877473a563
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
958c19b19b
commit
58f0e25d0d
@@ -534,13 +534,13 @@ static int system_heap_create(void)
|
|||||||
for (i = 0; i < NUM_ORDERS; i++) {
|
for (i = 0; i < NUM_ORDERS; i++) {
|
||||||
pools[i] = dmabuf_page_pool_create(order_flags[i], orders[i]);
|
pools[i] = dmabuf_page_pool_create(order_flags[i], orders[i]);
|
||||||
|
|
||||||
if (IS_ERR(pools[i])) {
|
if (!pools[i]) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
pr_err("%s: page pool creation failed!\n", __func__);
|
pr_err("%s: page pool creation failed!\n", __func__);
|
||||||
for (j = 0; j < i; j++)
|
for (j = 0; j < i; j++)
|
||||||
dmabuf_page_pool_destroy(pools[j]);
|
dmabuf_page_pool_destroy(pools[j]);
|
||||||
return PTR_ERR(pools[i]);
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user