We can remove one call sites for clear_cma_bitmap() if we first
call it before checking error number.

Acked-by: Minchan Kim <[email protected]>
Reviewed-by: Michal Nazarewicz <[email protected]>
Reviewed-by: Zhang Yanfei <[email protected]>
Reviewed-by: Aneesh Kumar K.V <[email protected]>
Signed-off-by: Joonsoo Kim <[email protected]>

diff --git a/mm/cma.c b/mm/cma.c
index 0cf50da..b442a13 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -285,11 +285,12 @@ struct page *cma_alloc(struct cma *cma, int count, 
unsigned int align)
                if (ret == 0) {
                        page = pfn_to_page(pfn);
                        break;
-               } else if (ret != -EBUSY) {
-                       cma_clear_bitmap(cma, pfn, count);
-                       break;
                }
+
                cma_clear_bitmap(cma, pfn, count);
+               if (ret != -EBUSY)
+                       break;
+
                pr_debug("%s(): memory range at %p is busy, retrying\n",
                         __func__, pfn_to_page(pfn));
                /* try again with a bit different memory target */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to