mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Huewe <peterhuewe@gmx.de>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Mark Allyn <mark.a.allyn@intel.com>,
	Alan Cox <alan@linux.intel.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	Joe Perches <joe@perches.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Peter Huewe <peterhuewe@gmx.de>
Subject: [PATCH 2/3] staging/sep: Fix sparse warning 'Using plain integer as NULL pointer'
Date: Mon, 29 Nov 2010 22:31:19 +0100	[thread overview]
Message-ID: <1291066280-19126-2-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1291066280-19126-1-git-send-email-peterhuewe@gmx.de>

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

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
LinuxVersion: linux-next-20101129

 drivers/staging/sep/sep_driver.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 0c802dc..cf5c897 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -510,12 +510,12 @@ static int sep_free_dma_table_data_handler(struct sep_device *sep)
 		}
 
 		/* reset all the values */
-		dma->in_page_array = 0;
-		dma->out_page_array = 0;
+		dma->in_page_array = NULL;
+		dma->out_page_array = NULL;
 		dma->in_num_pages = 0;
 		dma->out_num_pages = 0;
-		dma->in_map_array = 0;
-		dma->out_map_array = 0;
+		dma->in_map_array = NULL;
+		dma->out_map_array = NULL;
 		dma->in_map_num_entries = 0;
 		dma->out_map_num_entries = 0;
 
@@ -1298,13 +1298,13 @@ static int sep_lock_kernel_pages(struct sep_device *sep,
 	if (in_out_flag == SEP_DRIVER_IN_FLAG) {
 		*lli_array_ptr = lli_array;
 		sep->dma_res_arr[sep->nr_dcb_creat].in_num_pages = 1;
-		sep->dma_res_arr[sep->nr_dcb_creat].in_page_array = 0;
+		sep->dma_res_arr[sep->nr_dcb_creat].in_page_array = NULL;
 		sep->dma_res_arr[sep->nr_dcb_creat].in_map_array = map_array;
 		sep->dma_res_arr[sep->nr_dcb_creat].in_map_num_entries = 1;
 	} else {
 		*lli_array_ptr = lli_array;
 		sep->dma_res_arr[sep->nr_dcb_creat].out_num_pages = 1;
-		sep->dma_res_arr[sep->nr_dcb_creat].out_page_array = 0;
+		sep->dma_res_arr[sep->nr_dcb_creat].out_page_array = NULL;
 		sep->dma_res_arr[sep->nr_dcb_creat].out_map_array = map_array;
 		sep->dma_res_arr[sep->nr_dcb_creat].out_map_num_entries = 1;
 	}
@@ -1430,7 +1430,7 @@ static int sep_lock_user_pages(struct sep_device *sep,
 	result = get_user_pages(current, current->mm, app_virt_addr,
 		num_pages,
 		((in_out_flag == SEP_DRIVER_IN_FLAG) ? 0 : 1),
-		0, page_array, 0);
+		0, page_array, NULL);
 
 	up_read(&current->mm->mmap_sem);
 
@@ -1993,7 +1993,7 @@ static int sep_prepare_input_dma_table(struct sep_device *sep,
 		"block_size is %x\n", block_size);
 
 	/* initialize the pages pointers */
-	sep->dma_res_arr[sep->nr_dcb_creat].in_page_array = 0;
+	sep->dma_res_arr[sep->nr_dcb_creat].in_page_array = NULL;
 	sep->dma_res_arr[sep->nr_dcb_creat].in_num_pages = 0;
 
 	/* set the kernel address for first table to be allocated */
@@ -2037,7 +2037,7 @@ static int sep_prepare_input_dma_table(struct sep_device *sep,
 		sep->dma_res_arr[sep->nr_dcb_creat].in_num_pages);
 
 	current_entry = 0;
-	info_entry_ptr = 0;
+	info_entry_ptr = NULL;
 
 	sep_lli_entries =
 		sep->dma_res_arr[sep->nr_dcb_creat].in_num_pages;
@@ -2088,7 +2088,7 @@ static int sep_prepare_input_dma_table(struct sep_device *sep,
 			in_lli_table_ptr,
 			&current_entry, &num_entries_in_table, table_data_size);
 
-		if (info_entry_ptr == 0) {
+		if (info_entry_ptr == NULL) {
 
 			/* set the output parameters to physical addresses */
 			*lli_table_ptr = sep_shared_area_virt_to_bus(sep,
@@ -2185,16 +2185,16 @@ static int sep_construct_dma_tables_from_lli(
 	u32 lli_table_alloc_addr = 0;
 
 	/* input lli table */
-	struct sep_lli_entry *in_lli_table_ptr = 0;
+	struct sep_lli_entry *in_lli_table_ptr = NULL;
 
 	/* output lli table */
-	struct sep_lli_entry *out_lli_table_ptr = 0;
+	struct sep_lli_entry *out_lli_table_ptr = NULL;
 
 	/* pointer to the info entry of the table - the last entry */
-	struct sep_lli_entry *info_in_entry_ptr = 0;
+	struct sep_lli_entry *info_in_entry_ptr = NULL;
 
 	/* pointer to the info entry of the table - the last entry */
-	struct sep_lli_entry *info_out_entry_ptr = 0;
+	struct sep_lli_entry *info_out_entry_ptr = NULL;
 
 	/* points to the first entry to be processed in the lli_in_array */
 	u32 current_in_entry = 0;
@@ -2321,7 +2321,7 @@ static int sep_construct_dma_tables_from_lli(
 			table_data_size);
 
 		/* if info entry is null - this is the first table built */
-		if (info_in_entry_ptr == 0) {
+		if (info_in_entry_ptr == NULL) {
 			/* set the output parameters to physical addresses */
 			*lli_table_in_ptr =
 			sep_shared_area_virt_to_bus(sep, in_lli_table_ptr);
@@ -2464,8 +2464,8 @@ static int sep_prepare_input_output_dma_table(struct sep_device *sep,
 	}
 
 	/* initialize the pages pointers */
-	sep->dma_res_arr[sep->nr_dcb_creat].in_page_array = 0;
-	sep->dma_res_arr[sep->nr_dcb_creat].out_page_array = 0;
+	sep->dma_res_arr[sep->nr_dcb_creat].in_page_array = NULL;
+	sep->dma_res_arr[sep->nr_dcb_creat].out_page_array = NULL;
 
 	/* lock the pages of the buffer and translate them to pages */
 	if (is_kva == true) {
@@ -2603,7 +2603,7 @@ static int sep_prepare_input_output_dma_table_in_dcb(struct sep_device *sep,
 	u32 tail_size = 0;
 
 	/* address of the created dcb table */
-	struct sep_dcblock *dcb_table_ptr = 0;
+	struct sep_dcblock *dcb_table_ptr = NULL;
 
 	/* the physical address of the first input DMA table */
 	dma_addr_t in_first_mlli_address = 0;
@@ -2920,7 +2920,7 @@ static int sep_get_static_pool_addr_handler(struct sep_device *sep,
 {
 	struct stat_pool_addr_struct command_args;
 
-	u32 *static_pool_addr = 0;
+	u32 *static_pool_addr = NULL;
 
 	unsigned long addr_hold;
 
-- 
1.7.2.2


  reply	other threads:[~2010-11-29 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 21:31 [PATCH 1/3] staging/sep: Fix sparse warning 'do-while statement is not a compound statement' Peter Huewe
2010-11-29 21:31 ` Peter Huewe [this message]
2010-11-29 21:31 ` [PATCH 3/3] staging/sep: Fix sparse printk format warning Peter Huewe
2010-11-29 21:49   ` Randy Dunlap
2010-11-29 21:59     ` Peter Hüwe
2010-11-29 22:01       ` Randy Dunlap
2010-11-29 23:18         ` Jiri Slaby
2010-12-01 22:52 ` [PATCH 1/3] staging: sep: Fix sparse warning 'do-while statement is not a compound statement' Greg KH
2010-12-01 23:43   ` [PATCH 1/3] staging/sep: " Peter Huewe
2010-12-01 23:43   ` [PATCH 2/3] staging/sep: Fix sparse warning 'Using plain integer as NULL pointer' Peter Huewe
2010-12-01 23:43   ` [PATCH 3/3] staging/sep: Fix printk format warning Peter Huewe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291066280-19126-2-git-send-email-peterhuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=alan@linux.intel.com \
    --cc=ben@decadent.org.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.a.allyn@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®