All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipmi: work around gcc-4.9 build warning
@ 2014-08-23 19:04 ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2014-08-23 19:04 UTC (permalink / raw)
  To: Corey Minyard; +Cc: openipmi-developer, linux-kernel, linux-arm-kernel

Building ipmi on arm with gcc-4.9 results in this warning
for an allmodconfig build:

drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_thread':
include/linux/time.h:28:5: warning: 'busy_until.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (lhs->tv_sec > rhs->tv_sec)
     ^
drivers/char/ipmi/ipmi_si_intf.c:1007:18: note: 'busy_until.tv_sec' was declared here
  struct timespec busy_until;
                  ^

The warning is bogus and this case can not occur. Apparently
this is a false positive resulting from gcc getting a little
smarter about tracking assignments but not smart enough. Marking
the ipmi_thread_busy_wait function as inline gives the gcc
optimization logic enough information to figure out for itself
that the case cannot happen, which gets rid of the warning
without adding any fake initialization.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 5d665680ae33..539ff0db52fc 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -965,9 +965,9 @@ static inline int ipmi_si_is_busy(struct timespec *ts)
 	return ts->tv_nsec != -1;
 }
 
-static int ipmi_thread_busy_wait(enum si_sm_result smi_result,
-				 const struct smi_info *smi_info,
-				 struct timespec *busy_until)
+static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
+					const struct smi_info *smi_info,
+					struct timespec *busy_until)
 {
 	unsigned int max_busy_us = 0;
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ipmi: work around gcc-4.9 build warning
@ 2014-08-23 19:04 ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2014-08-23 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

Building ipmi on arm with gcc-4.9 results in this warning
for an allmodconfig build:

drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_thread':
include/linux/time.h:28:5: warning: 'busy_until.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (lhs->tv_sec > rhs->tv_sec)
     ^
drivers/char/ipmi/ipmi_si_intf.c:1007:18: note: 'busy_until.tv_sec' was declared here
  struct timespec busy_until;
                  ^

The warning is bogus and this case can not occur. Apparently
this is a false positive resulting from gcc getting a little
smarter about tracking assignments but not smart enough. Marking
the ipmi_thread_busy_wait function as inline gives the gcc
optimization logic enough information to figure out for itself
that the case cannot happen, which gets rid of the warning
without adding any fake initialization.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 5d665680ae33..539ff0db52fc 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -965,9 +965,9 @@ static inline int ipmi_si_is_busy(struct timespec *ts)
 	return ts->tv_nsec != -1;
 }
 
-static int ipmi_thread_busy_wait(enum si_sm_result smi_result,
-				 const struct smi_info *smi_info,
-				 struct timespec *busy_until)
+static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
+					const struct smi_info *smi_info,
+					struct timespec *busy_until)
 {
 	unsigned int max_busy_us = 0;
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipmi: work around gcc-4.9 build warning
  2014-08-23 19:04 ` Arnd Bergmann
@ 2014-09-09 18:21   ` Corey Minyard
  -1 siblings, 0 replies; 4+ messages in thread
From: Corey Minyard @ 2014-09-09 18:21 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: openipmi-developer, linux-kernel, linux-arm-kernel

I'd prefer to fix gcc, but I understand.  This change is probably better
in general, anyway.

Queued for 3.18.  Thanks.

-corey

On 08/23/2014 02:04 PM, Arnd Bergmann wrote:
> Building ipmi on arm with gcc-4.9 results in this warning
> for an allmodconfig build:
>
> drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_thread':
> include/linux/time.h:28:5: warning: 'busy_until.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   if (lhs->tv_sec > rhs->tv_sec)
>      ^
> drivers/char/ipmi/ipmi_si_intf.c:1007:18: note: 'busy_until.tv_sec' was declared here
>   struct timespec busy_until;
>                   ^
>
> The warning is bogus and this case can not occur. Apparently
> this is a false positive resulting from gcc getting a little
> smarter about tracking assignments but not smart enough. Marking
> the ipmi_thread_busy_wait function as inline gives the gcc
> optimization logic enough information to figure out for itself
> that the case cannot happen, which gets rid of the warning
> without adding any fake initialization.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index 5d665680ae33..539ff0db52fc 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -965,9 +965,9 @@ static inline int ipmi_si_is_busy(struct timespec *ts)
>  	return ts->tv_nsec != -1;
>  }
>  
> -static int ipmi_thread_busy_wait(enum si_sm_result smi_result,
> -				 const struct smi_info *smi_info,
> -				 struct timespec *busy_until)
> +static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
> +					const struct smi_info *smi_info,
> +					struct timespec *busy_until)
>  {
>  	unsigned int max_busy_us = 0;
>  
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ipmi: work around gcc-4.9 build warning
@ 2014-09-09 18:21   ` Corey Minyard
  0 siblings, 0 replies; 4+ messages in thread
From: Corey Minyard @ 2014-09-09 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

I'd prefer to fix gcc, but I understand.  This change is probably better
in general, anyway.

Queued for 3.18.  Thanks.

-corey

On 08/23/2014 02:04 PM, Arnd Bergmann wrote:
> Building ipmi on arm with gcc-4.9 results in this warning
> for an allmodconfig build:
>
> drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_thread':
> include/linux/time.h:28:5: warning: 'busy_until.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   if (lhs->tv_sec > rhs->tv_sec)
>      ^
> drivers/char/ipmi/ipmi_si_intf.c:1007:18: note: 'busy_until.tv_sec' was declared here
>   struct timespec busy_until;
>                   ^
>
> The warning is bogus and this case can not occur. Apparently
> this is a false positive resulting from gcc getting a little
> smarter about tracking assignments but not smart enough. Marking
> the ipmi_thread_busy_wait function as inline gives the gcc
> optimization logic enough information to figure out for itself
> that the case cannot happen, which gets rid of the warning
> without adding any fake initialization.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index 5d665680ae33..539ff0db52fc 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -965,9 +965,9 @@ static inline int ipmi_si_is_busy(struct timespec *ts)
>  	return ts->tv_nsec != -1;
>  }
>  
> -static int ipmi_thread_busy_wait(enum si_sm_result smi_result,
> -				 const struct smi_info *smi_info,
> -				 struct timespec *busy_until)
> +static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result,
> +					const struct smi_info *smi_info,
> +					struct timespec *busy_until)
>  {
>  	unsigned int max_busy_us = 0;
>  
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-09 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-23 19:04 [PATCH] ipmi: work around gcc-4.9 build warning Arnd Bergmann
2014-08-23 19:04 ` Arnd Bergmann
2014-09-09 18:21 ` Corey Minyard
2014-09-09 18:21   ` Corey Minyard

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.