Skip to contentSkip to conversation

staging/zram: Fix sparse warning 'Using plain integer as NULL pointer'

PATCH In review Peter Huewe 3 participants 4 messages Dec 7, 2010 – Dec 8, 2010 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging/zram: Fix sparse warning 'Using plain integer as NULL pointer'

This patch fixes the warning generated by sparse: "Using plain integer as NULL pointer" by replacing the offending 0s with NULL.

---
KernelVersion: linux-next-20101207

 drivers/staging/zram/xvmalloc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/zram/xvmalloc.c +3 -3
index 3fdbb8a..b644067 100644
@@ -187,7 +187,7 @@ static void insert_block(struct xv_pool *pool, struct page *page, u32 offset,
 	slindex = get_index_for_insert(block->size);
 	flindex = slindex / BITS_PER_LONG;
 
-	block->link.prev_page = 0;
+	block->link.prev_page = NULL;
 	block->link.prev_offset = 0;
 	block->link.next_page = pool->freelist[slindex].page;
 	block->link.next_offset = pool->freelist[slindex].offset;
@@ -217,7 +217,7 @@ static void remove_block_head(struct xv_pool *pool,
 
 	pool->freelist[slindex].page = block->link.next_page;
 	pool->freelist[slindex].offset = block->link.next_offset;
-	block->link.prev_page = 0;
+	block->link.prev_page = NULL;
 	block->link.prev_offset = 0;
 
 	if (!pool->freelist[slindex].page) {
@@ -232,7 +232,7 @@ static void remove_block_head(struct xv_pool *pool,
 		 */
 		tmpblock = get_ptr_atomic(pool->freelist[slindex].page,
 				pool->freelist[slindex].offset, KM_USER1);
-		tmpblock->link.prev_page = 0;
+		tmpblock->link.prev_page = NULL;
 		tmpblock->link.prev_offset = 0;
 		put_ptr_atomic(tmpblock, KM_USER1);
 	}
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 4 lines · Peter Huewe

This patch fixes the warning generated by sparse: "Using plain integer as NULL pointer" by replacing the offending 0s with NULL.

Thanks for the fix. I see that it's already fixed in the project internal repo but I somehow missed sending it to mainline.

Nitin

#2 lore raw
Quoted 9 lines · Nitin Gupta
Quoted 4 lines · Peter Huewe

This patch fixes the warning generated by sparse: "Using plain integer as NULL pointer" by replacing the offending 0s with NULL.

Thanks for the fix. I see that it's already fixed in the project internal repo but I somehow missed sending it to mainline.

Are you ever going to sync your internal repo with the in-kernel one, or should I just delete the in-kernel one?

thanks,

greg k-h

#3 lore raw
Quoted 5 lines · Greg KH
Quoted 4 lines · Nitin Gupta
Quoted 3 lines · Peter Huewe

This patch fixes the warning generated by sparse: "Using plain integer as NULL pointer" by replacing the offending 0s with NULL.

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

Thanks for the fix. I see that it's already fixed in the project internal repo but I somehow missed sending it to mainline.

Are you ever going to sync your internal repo with the in-kernel one, or should I just delete the in-kernel one?

It is almost sync'ed up (apart from "scalability enhancements") but I somehow missed this part. Currently, I'm completely occupied with final exams due next week. So, please be patient.

I plan to completely discard scalability part and solve outstanding crash reports (http://code.google.com/p/compcache/issues/list) once this school overhead is over.

Thanks,
Nitin