Thread (9 messages) flat view 9 messages, 5 authors, 2016-06-14
STALE3750d

Re: [PATCH] cpufreq: mvebu: fix integer to pointer cast

From: Mason <hidden>
Date: 2016-06-08 07:56:11
Also in: linux-arm-kernel

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help