All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free.fr>
To: Ben Dooks <ben.dooks@codethink.co.uk>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-kernel@lists.codethink.co.uk, linux-pm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] cpufreq: mvebu: fix integer to pointer cast
Date: Wed, 8 Jun 2016 09:56:11 +0200	[thread overview]
Message-ID: <5757CF9B.3080402@free.fr> (raw)
In-Reply-To: <1465299013-32369-1-git-send-email-ben.dooks@codethink.co.uk>

On 07/06/2016 13:30, Ben Dooks wrote:

> Fix the use of 0 instead of NULL to clk_get() call. This stops the
> following warning:
> 
> drivers/cpufreq/mvebu-cpufreq.c:73:40: warning: Using plain integer as NULL pointer

May I ask which compiler/version produced that diagnostic?


> -		clk = clk_get(cpu_dev, 0);
> +		clk = clk_get(cpu_dev, NULL);

Quoting C99 6.3.2.3 Pointers clause 3

> An integer constant expression with the value 0, or such an expression cast to type
> void *, is called a null pointer constant. If a null pointer constant is converted to a
> pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
> to a pointer to any object or function.

In fact, some implementations merely #define NULL 0
(which, admittedly, creates problems when NULL is used as a parameter
to variadic functions)

Regards.

WARNING: multiple messages have this Message-ID (diff)
From: slash.tmp@free.fr (Mason)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] cpufreq: mvebu: fix integer to pointer cast
Date: Wed, 8 Jun 2016 09:56:11 +0200	[thread overview]
Message-ID: <5757CF9B.3080402@free.fr> (raw)
In-Reply-To: <1465299013-32369-1-git-send-email-ben.dooks@codethink.co.uk>

On 07/06/2016 13:30, Ben Dooks wrote:

> Fix the use of 0 instead of NULL to clk_get() call. This stops the
> following warning:
> 
> drivers/cpufreq/mvebu-cpufreq.c:73:40: warning: Using plain integer as NULL pointer

May I ask which compiler/version produced that diagnostic?


> -		clk = clk_get(cpu_dev, 0);
> +		clk = clk_get(cpu_dev, NULL);

Quoting C99 6.3.2.3 Pointers clause 3

> An integer constant expression with the value 0, or such an expression cast to type
> void *, is called a null pointer constant. If a null pointer constant is converted to a
> pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
> to a pointer to any object or function.

In fact, some implementations merely #define NULL 0
(which, admittedly, creates problems when NULL is used as a parameter
to variadic functions)

Regards.

  parent reply	other threads:[~2016-06-08  7:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 11:30 [PATCH] cpufreq: mvebu: fix integer to pointer cast Ben Dooks
2016-06-07 11:30 ` Ben Dooks
2016-06-07 13:40 ` Viresh Kumar
2016-06-07 13:40   ` Viresh Kumar
2016-06-14 23:27   ` Rafael J. Wysocki
2016-06-14 23:27     ` Rafael J. Wysocki
2016-06-08  7:56 ` Mason [this message]
2016-06-08  7:56   ` Mason
2016-06-08  8:59   ` Ben Dooks
2016-06-08  8:59     ` Ben Dooks
2016-06-09  7:07     ` Arnd Bergmann
2016-06-09  7:07       ` Arnd Bergmann
2016-06-09  7:53       ` Mason
2016-06-09  7:53         ` Mason
2016-06-09  8:11       ` Ben Dooks
2016-06-09  8:11         ` Ben Dooks
2016-06-09 13:53         ` Arnd Bergmann
2016-06-09 13:53           ` Arnd Bergmann

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=5757CF9B.3080402@free.fr \
    --to=slash.tmp@free.fr \
    --cc=ben.dooks@codethink.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-pm@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.