* [PATCH 10/68] 0 -> NULL, for arch/mips
@ 2007-07-27 9:45 Yoann Padioleau
2007-07-27 12:23 ` Ralf Baechle
2007-07-28 12:43 ` Markus Gothe
0 siblings, 2 replies; 3+ messages in thread
From: Yoann Padioleau @ 2007-07-27 9:45 UTC (permalink / raw)
To: kernel-janitors; +Cc: ralf, linux-mips, akpm, linux-kernel
When comparing a pointer, it's clearer to compare it to NULL than to 0.
Here is an excerpt of the semantic patch:
@@
expression *E;
@@
E ==
- 0
+ NULL
@@
expression *E;
@@
E !=
- 0
+ NULL
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org
Cc: akpm@linux-foundation.org
---
ops-emma2rh.c | 2 +-
ops-pnx8550.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
index 38f1816..d31bfc6 100644
--- a/arch/mips/pci/ops-emma2rh.c
+++ b/arch/mips/pci/ops-emma2rh.c
@@ -45,7 +45,7 @@ static int check_args(struct pci_bus *bu
/* check if the bus is top-level */
if (bus->parent != NULL) {
*bus_num = bus->number;
- db_assert(bus_num != 0);
+ db_assert(bus_num != NULL);
} else
*bus_num = 0;
diff --git a/arch/mips/pci/ops-pnx8550.c b/arch/mips/pci/ops-pnx8550.c
index f556b7a..d610646 100644
--- a/arch/mips/pci/ops-pnx8550.c
+++ b/arch/mips/pci/ops-pnx8550.c
@@ -117,7 +117,7 @@ read_config_byte(struct pci_bus *bus, un
unsigned int data = 0;
int err;
- if (bus == 0)
+ if (bus == NULL)
return -1;
err = config_access(PCI_CMD_CONFIG_READ, bus, devfn, where, ~(1 << (where & 3)), &data);
@@ -145,7 +145,7 @@ read_config_word(struct pci_bus *bus, un
unsigned int data = 0;
int err;
- if (bus == 0)
+ if (bus == NULL)
return -1;
if (where & 0x01)
@@ -168,7 +168,7 @@ static int
read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 * val)
{
int err;
- if (bus == 0)
+ if (bus == NULL)
return -1;
if (where & 0x03)
@@ -185,7 +185,7 @@ write_config_byte(struct pci_bus *bus, u
unsigned int data = (unsigned int)val;
int err;
- if (bus == 0)
+ if (bus == NULL)
return -1;
switch (where & 0x03) {
@@ -213,7 +213,7 @@ write_config_word(struct pci_bus *bus, u
unsigned int data = (unsigned int)val;
int err;
- if (bus == 0)
+ if (bus == NULL)
return -1;
if (where & 0x01)
@@ -235,7 +235,7 @@ static int
write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val)
{
int err;
- if (bus == 0)
+ if (bus == NULL)
return -1;
if (where & 0x03)
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 10/68] 0 -> NULL, for arch/mips
2007-07-27 9:45 [PATCH 10/68] 0 -> NULL, for arch/mips Yoann Padioleau
@ 2007-07-27 12:23 ` Ralf Baechle
2007-07-28 12:43 ` Markus Gothe
1 sibling, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2007-07-27 12:23 UTC (permalink / raw)
To: Yoann Padioleau; +Cc: kernel-janitors, linux-mips, akpm, linux-kernel
On Fri, Jul 27, 2007 at 11:45:00AM +0200, Yoann Padioleau wrote:
Applied.
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 10/68] 0 -> NULL, for arch/mips
2007-07-27 9:45 [PATCH 10/68] 0 -> NULL, for arch/mips Yoann Padioleau
2007-07-27 12:23 ` Ralf Baechle
@ 2007-07-28 12:43 ` Markus Gothe
1 sibling, 0 replies; 3+ messages in thread
From: Markus Gothe @ 2007-07-28 12:43 UTC (permalink / raw)
To: Yoann Padioleau; +Cc: kernel-janitors, ralf, linux-mips, akpm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 3044 bytes --]
Usually it's not only cleaner, it's what you want to do... AFAIK
'NULL' is implemented/defined by the compiler, so if you've got a
compiler which defines NULL otherwise than( a pointer to) zero you're
screwed. ;)
//Markus
On 27 Jul, 2007, at 11:45 , Yoann Padioleau wrote:
>
> When comparing a pointer, it's clearer to compare it to NULL than
> to 0.
>
> Here is an excerpt of the semantic patch:
>
> @@
> expression *E;
> @@
>
> E ==
> - 0
> + NULL
>
> @@
> expression *E;
> @@
>
> E !=
> - 0
> + NULL
>
> Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
> Cc: ralf@linux-mips.org
> Cc: linux-mips@linux-mips.org
> Cc: akpm@linux-foundation.org
> ---
>
> ops-emma2rh.c | 2 +-
> ops-pnx8550.c | 12 ++++++------
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
> index 38f1816..d31bfc6 100644
> --- a/arch/mips/pci/ops-emma2rh.c
> +++ b/arch/mips/pci/ops-emma2rh.c
> @@ -45,7 +45,7 @@ static int check_args(struct pci_bus *bu
> /* check if the bus is top-level */
> if (bus->parent != NULL) {
> *bus_num = bus->number;
> - db_assert(bus_num != 0);
> + db_assert(bus_num != NULL);
> } else
> *bus_num = 0;
>
> diff --git a/arch/mips/pci/ops-pnx8550.c b/arch/mips/pci/ops-pnx8550.c
> index f556b7a..d610646 100644
> --- a/arch/mips/pci/ops-pnx8550.c
> +++ b/arch/mips/pci/ops-pnx8550.c
> @@ -117,7 +117,7 @@ read_config_byte(struct pci_bus *bus, un
> unsigned int data = 0;
> int err;
>
> - if (bus == 0)
> + if (bus == NULL)
> return -1;
>
> err = config_access(PCI_CMD_CONFIG_READ, bus, devfn, where, ~(1
> << (where & 3)), &data);
> @@ -145,7 +145,7 @@ read_config_word(struct pci_bus *bus, un
> unsigned int data = 0;
> int err;
>
> - if (bus == 0)
> + if (bus == NULL)
> return -1;
>
> if (where & 0x01)
> @@ -168,7 +168,7 @@ static int
> read_config_dword(struct pci_bus *bus, unsigned int devfn, int
> where, u32 * val)
> {
> int err;
> - if (bus == 0)
> + if (bus == NULL)
> return -1;
>
> if (where & 0x03)
> @@ -185,7 +185,7 @@ write_config_byte(struct pci_bus *bus, u
> unsigned int data = (unsigned int)val;
> int err;
>
> - if (bus == 0)
> + if (bus == NULL)
> return -1;
>
> switch (where & 0x03) {
> @@ -213,7 +213,7 @@ write_config_word(struct pci_bus *bus, u
> unsigned int data = (unsigned int)val;
> int err;
>
> - if (bus == 0)
> + if (bus == NULL)
> return -1;
>
> if (where & 0x01)
> @@ -235,7 +235,7 @@ static int
> write_config_dword(struct pci_bus *bus, unsigned int devfn, int
> where, u32 val)
> {
> int err;
> - if (bus == 0)
> + if (bus == NULL)
> return -1;
>
> if (where & 0x03)
>
>
_______________________________________
Mr Markus Gothe
Software Engineer
Phone: +46 (0)13 21 81 20 (ext. 1046)
Fax: +46 (0)13 21 21 15
Mobile: +46 (0)73 718 72 80
Diskettgatan 11, SE-583 35 Linköping, Sweden
www.27m.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-28 13:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 9:45 [PATCH 10/68] 0 -> NULL, for arch/mips Yoann Padioleau
2007-07-27 12:23 ` Ralf Baechle
2007-07-28 12:43 ` Markus Gothe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox