aboutsummaryrefslogtreecommitdiffstats
path: root/mm/dmapool.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/dmapool.c')
-rw-r--r--mm/dmapool.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mm/dmapool.c b/mm/dmapool.c
index b5ff9ce8765b..744d541df866 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -106,17 +106,18 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
106{ 106{
107 struct dma_pool *retval; 107 struct dma_pool *retval;
108 108
109 if (align == 0) 109 if (align == 0) {
110 align = 1; 110 align = 1;
111 if (size == 0) 111 } else if (align & (align - 1)) {
112 return NULL; 112 return NULL;
113 else if (size < align)
114 size = align;
115 else if ((size % align) != 0) {
116 size += align + 1;
117 size &= ~(align - 1);
118 } 113 }
119 114
115 if (size == 0)
116 return NULL;
117
118 if ((size % align) != 0)
119 size = ALIGN(size, align);
120
120 if (allocation == 0) { 121 if (allocation == 0) {
121 if (PAGE_SIZE < size) 122 if (PAGE_SIZE < size)
122 allocation = size; 123 allocation = size;