* [PATCH] mm: dmapool: Fixed following warnings
@ 2016-11-08 4:37 Ashish Kalra
0 siblings, 0 replies; only message in thread
From: Ashish Kalra @ 2016-11-08 4:37 UTC (permalink / raw)
To: Andrew Morton, Tejun Heo, Joe Perches
Cc: linux-mm, linux-kernel, Ashish Kalra, shailesh pandey, vidushi.koul
From: AshishKalra <ashish.kalra@samsung.com>
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
WARNING: Missing a blank line after declarations
Warning were detected with checkpatch.pl
Signed-off-by: AshishKalra <ashish.kalra@samsung.com>
---
mm/dmapool.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/mm/dmapool.c b/mm/dmapool.c
index abcbfe8..9fde077 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -67,8 +67,8 @@ struct dma_page { /* cacheable header for 'allocation' bytes */
static ssize_t
show_pools(struct device *dev, struct device_attribute *attr, char *buf)
{
- unsigned temp;
- unsigned size;
+ unsigned int temp;
+ unsigned int size;
char *next;
struct dma_page *page;
struct dma_pool *pool;
@@ -82,8 +82,8 @@ struct dma_page { /* cacheable header for 'allocation' bytes */
mutex_lock(&pools_lock);
list_for_each_entry(pool, &dev->dma_pools, pools) {
- unsigned pages = 0;
- unsigned blocks = 0;
+ unsigned int pages = 0;
+ unsigned int blocks = 0;
spin_lock_irq(&pool->lock);
list_for_each_entry(page, &pool->page_list, page_list) {
@@ -105,7 +105,7 @@ struct dma_page { /* cacheable header for 'allocation' bytes */
return PAGE_SIZE - size;
}
-static DEVICE_ATTR(pools, S_IRUGO, show_pools, NULL);
+static DEVICE_ATTR(pools, 0444, show_pools, NULL);
/**
* dma_pool_create - Creates a pool of consistent memory blocks, for dma.
@@ -210,6 +210,7 @@ static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
do {
unsigned int next = offset + pool->size;
+
if (unlikely((next + pool->size) >= next_boundary)) {
next = next_boundary;
next_boundary += pool->boundary;
@@ -286,6 +287,7 @@ void dma_pool_destroy(struct dma_pool *pool)
while (!list_empty(&pool->page_list)) {
struct dma_page *page;
+
page = list_entry(pool->page_list.next,
struct dma_page, page_list);
if (is_page_busy(page)) {
@@ -443,6 +445,7 @@ void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t dma)
}
{
unsigned int chain = page->offset;
+
while (chain < pool->allocation) {
if (chain != offset) {
chain = *(int *)(page->vaddr + chain);
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-08 4:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 4:37 [PATCH] mm: dmapool: Fixed following warnings Ashish Kalra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox