drivers: dma-contiguous: refactor dma_alloc_from_contiguous()

The dma_alloc_from_contiguous() function returns either a valid pointer
to a page structure or NULL, the error code set when pageno >= cma->count
is not used at all and can be safely removed.

This commit also changes the function to avoid goto and have only one exit
path and one place where mutex is unlocked.

Signed-off-by: Michal Nazarewicz <>
[fixed compilation break caused by missing semicolon]
Signed-off-by: Marek Szyprowski <>
1 file changed