Skip to contentSkip to conversation

mfd: menelaus: use NULL instead of 0

PATCH Superseded Jingoo Han 2 participants 3 messages Aug 2, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 mfd: menelaus: use NULL instead of 0

'mmc_callback_data' and 'vtg' are pointers.
Fix the following sparse warning:

drivers/mfd/menelaus.c:445:43: warning: Using plain integer as NULL pointer drivers/mfd/menelaus.c:469:20: warning: Using plain integer as NULL pointer

---
 drivers/mfd/menelaus.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/menelaus.c +2 -2
index 998ce8c..0f62ecd 100644
@@ -442,7 +442,7 @@ void menelaus_unregister_mmc_callback(void)
 	menelaus_remove_irq_work(MENELAUS_MMC_S2D1_IRQ);
 
 	the_menelaus->mmc_callback = NULL;
-	the_menelaus->mmc_callback_data = 0;
+	the_menelaus->mmc_callback_data = NULL;
 }
 EXPORT_SYMBOL(menelaus_unregister_mmc_callback);
 
@@ -466,7 +466,7 @@ static int menelaus_set_voltage(const struct menelaus_vtg *vtg, int mV,
 	struct i2c_client *c = the_menelaus->client;
 
 	mutex_lock(&the_menelaus->lock);
-	if (vtg == 0)
+	if (vtg == NULL)
 		goto set_voltage;
 
 	ret = menelaus_read_reg(vtg->vtg_reg);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 25 lines · Jingoo Han

'mmc_callback_data' and 'vtg' are pointers.
Fix the following sparse warning:

drivers/mfd/menelaus.c:445:43: warning: Using plain integer as NULL pointer drivers/mfd/menelaus.c:469:20: warning: Using plain integer as NULL pointer

---
 drivers/mfd/menelaus.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/menelaus.c +1 -1
index 998ce8c..0f62ecd 100644
@@ -442,7 +442,7 @@ void menelaus_unregister_mmc_callback(void)
        menelaus_remove_irq_work(MENELAUS_MMC_S2D1_IRQ);
 
        the_menelaus->mmc_callback = NULL;
-       the_menelaus->mmc_callback_data = 0;
+       the_menelaus->mmc_callback_data = NULL;
 }
 EXPORT_SYMBOL(menelaus_unregister_mmc_callback);
 

drivers/mfd/menelaus.c static int menelaus_set_voltage(const struct menelaus_vtg *vtg, int mV, · line 469

Quoted 5 lines
drivers/mfd/menelaus.c +1 -1
@@ -466,7 +466,7 @@ static int menelaus_set_voltage(const struct menelaus_vtg *vtg, int mV,
        struct i2c_client *c = the_menelaus->client;
 
        mutex_lock(&the_menelaus->lock);
-       if (vtg == 0)
+       if (vtg == NULL)

Instead you could just make this:

            if (!vtg)
Quoted 2 lines
drivers/mfd/menelaus.c +0 -0
                goto set_voltage;
 
Signature · 2 lines
With warm regards,
Sachin
author
#2 lore raw
Quoted 1 line · Sachin Kamat

On 2 August 2013 11:20, Jingoo Han <[email protected]> wrote:

[...]

Quoted 7 lines

drivers/mfd/menelaus.c static int menelaus_set_voltage(const struct menelaus_vtg *vtg, int mV, · line 469

Quoted 4 lines
        mutex_lock(&the_menelaus->lock);
drivers/mfd/menelaus.c +1 -1
-       if (vtg == 0)
+       if (vtg == NULL)

Instead you could just make this:

            if (!vtg)

Thank you for your comment. :)
It looks simpler. So, I will use it as you guide.

Best regards,
Jingoo Han