Re: [PATCH v2 15/15] NULL noise: mm/memcontrol.c

From: Hannes Eder
Date: Thu Mar 05 2009 - 18:05:06 EST


On Thu, Mar 5, 2009 at 11:42 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 05 Mar 2009 20:18:44 +0100
> Hannes Eder <hannes@xxxxxxxxxxxxxx> wrote:
>
>> Fix this sparse warning:
>>   mm/memcontrol.c:1637:32: warning: Using plain integer as NULL pointer
>>
>> Signed-off-by: Hannes Eder <hannes@xxxxxxxxxxxxxx>
>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
>> ---
>> v2: other subject, as suggested by Al Viro
>>
>>  mm/memcontrol.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 8e4be9c..09d6650 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -1634,7 +1634,7 @@ static int mem_cgroup_force_empty_list(struct mem_cgroup *mem,
>>               pc = list_entry(list->prev, struct page_cgroup, lru);
>>               if (busy == pc) {
>>                       list_move(&pc->lru, list);
>> -                     busy = 0;
>> +                     busy = NULL;
>>                       spin_unlock_irqrestore(&zone->lru_lock, flags);
>>                       continue;
>>               }
>
> I have to say that I wish sparse didn't do this.  Initialising a
> pointer with literal zero is perfectly clear and is idiomatic C.

We could turn it off with '-Wno-non-pointer-null', but then it is not
reported in other might useful cases either. Well, it's really a minor
thing, but fixing it, isn't a big deal either. Or is there any
drawback that I am not aware of?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/