public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] usb: xhci: remove the code build warning
  2018-06-05 16:35 [PATCH] usb: xhci: remove the code build warning Dongjiu Geng
@ 2018-06-05  8:40 ` Greg KH
  2018-06-05  8:54   ` gengdongjiu
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2018-06-05  8:40 UTC (permalink / raw)
  To: Dongjiu Geng
  Cc: mathias.nyman, thierry.reding, jonathanh, linux-usb, linux-tegra,
	linux-kernel

On Wed, Jun 06, 2018 at 12:35:00AM +0800, Dongjiu Geng wrote:
> Initialize the 'err' variate to remove the build warning,
> the warning is shown as below:
> 
> drivers/usb/host/xhci-tegra.c: In function ‘tegra_xusb_mbox_thread’:
> drivers/usb/host/xhci-tegra.c:552:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
> drivers/usb/host/xhci-tegra.c:482:6: note: ‘err’ was declared here
> 
> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> ---

Any hint as to what commit caused this warning to show up?

thanks,

greg k-h

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

* Re: [PATCH] usb: xhci: remove the code build warning
  2018-06-05  8:40 ` Greg KH
@ 2018-06-05  8:54   ` gengdongjiu
  2018-06-05  9:06     ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: gengdongjiu @ 2018-06-05  8:54 UTC (permalink / raw)
  To: Greg KH
  Cc: mathias.nyman, thierry.reding, jonathanh, linux-usb, linux-tegra,
	linux-kernel



On 2018/6/5 16:40, Greg KH wrote:
> On Wed, Jun 06, 2018 at 12:35:00AM +0800, Dongjiu Geng wrote:
>> Initialize the 'err' variate to remove the build warning,
>> the warning is shown as below:
>>
>> drivers/usb/host/xhci-tegra.c: In function ‘tegra_xusb_mbox_thread’:
>> drivers/usb/host/xhci-tegra.c:552:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
>> drivers/usb/host/xhci-tegra.c:482:6: note: ‘err’ was declared here
>>
>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>> ---
> 
> Any hint as to what commit caused this warning to show up?

It seems below commit:

commit e84fce0f8837496a48d11086829bdbe170358b7a
Author: Thierry Reding <treding@nvidia.com>
Date:   Thu Feb 11 18:10:48 2016 +0100

    usb: xhci: Add NVIDIA Tegra XUSB controller driver

    Add support for the on-chip XUSB controller present on Tegra SoCs. This
    controller, when loaded with external firmware, exposes an interface
    compliant with xHCI. This driver loads the firmware, starts the
    controller, and is able to service host-specific messages sent by the
    controller's firmware.

    The controller also supports USB device mode as well as powergating
    of the SuperSpeed and host-controller logic when not in use, but
    support for these is not yet implemented.

    Based on work by:
      Ajay Gupta <ajayg@nvidia.com>
      Bharath Yadav <byadav@nvidia.com>
      Andrew Bresticker <abrestic@chromium.org>

    Cc: Mathias Nyman <mathias.nyman@intel.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Thierry Reding <treding@nvidia.com>


> 
> thanks,
> 
> greg k-h
> 
> .
> 

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

* Re: [PATCH] usb: xhci: remove the code build warning
  2018-06-05  8:54   ` gengdongjiu
@ 2018-06-05  9:06     ` Thierry Reding
  2018-06-05  9:12       ` gengdongjiu
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2018-06-05  9:06 UTC (permalink / raw)
  To: gengdongjiu
  Cc: Greg KH, mathias.nyman, jonathanh, linux-usb, linux-tegra,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2438 bytes --]

On Tue, Jun 05, 2018 at 04:54:17PM +0800, gengdongjiu wrote:
> 
> 
> On 2018/6/5 16:40, Greg KH wrote:
> > On Wed, Jun 06, 2018 at 12:35:00AM +0800, Dongjiu Geng wrote:
> >> Initialize the 'err' variate to remove the build warning,
> >> the warning is shown as below:
> >>
> >> drivers/usb/host/xhci-tegra.c: In function ‘tegra_xusb_mbox_thread’:
> >> drivers/usb/host/xhci-tegra.c:552:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
> >> drivers/usb/host/xhci-tegra.c:482:6: note: ‘err’ was declared here
> >>
> >> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> >> ---
> > 
> > Any hint as to what commit caused this warning to show up?
> 
> It seems below commit:
> 
> commit e84fce0f8837496a48d11086829bdbe170358b7a
> Author: Thierry Reding <treding@nvidia.com>
> Date:   Thu Feb 11 18:10:48 2016 +0100
> 
>     usb: xhci: Add NVIDIA Tegra XUSB controller driver
> 
>     Add support for the on-chip XUSB controller present on Tegra SoCs. This
>     controller, when loaded with external firmware, exposes an interface
>     compliant with xHCI. This driver loads the firmware, starts the
>     controller, and is able to service host-specific messages sent by the
>     controller's firmware.
> 
>     The controller also supports USB device mode as well as powergating
>     of the SuperSpeed and host-controller logic when not in use, but
>     support for these is not yet implemented.
> 
>     Based on work by:
>       Ajay Gupta <ajayg@nvidia.com>
>       Bharath Yadav <byadav@nvidia.com>
>       Andrew Bresticker <abrestic@chromium.org>
> 
>     Cc: Mathias Nyman <mathias.nyman@intel.com>
>     Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>     Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>     Signed-off-by: Thierry Reding <treding@nvidia.com>

I've never seen this warning before. It's also a false positive in that
technically the mailbox message will always have at least one bit set in
"mask". However, I don't see how the compiler could know about it, given
that the data comes from an external source, so I think this makes sense
as a hint to the compiler. So:

Acked-by: Thierry Reding <treding@nvidia.com>

Can you provide more detail on what exact version of which compiler you
used that triggered this? I wonder why it's never presented itself with
the compiler that I use.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] usb: xhci: remove the code build warning
  2018-06-05  9:06     ` Thierry Reding
@ 2018-06-05  9:12       ` gengdongjiu
  0 siblings, 0 replies; 5+ messages in thread
From: gengdongjiu @ 2018-06-05  9:12 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Greg KH, mathias.nyman, jonathanh, linux-usb, linux-tegra,
	linux-kernel

On 2018/6/5 17:06, Thierry Reding wrote:
> On Tue, Jun 05, 2018 at 04:54:17PM +0800, gengdongjiu wrote:
>>
>>
>> On 2018/6/5 16:40, Greg KH wrote:
>>> On Wed, Jun 06, 2018 at 12:35:00AM +0800, Dongjiu Geng wrote:
>>>> Initialize the 'err' variate to remove the build warning,
>>>> the warning is shown as below:
>>>>
>>>> drivers/usb/host/xhci-tegra.c: In function ‘tegra_xusb_mbox_thread’:
>>>> drivers/usb/host/xhci-tegra.c:552:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
>>>> drivers/usb/host/xhci-tegra.c:482:6: note: ‘err’ was declared here
>>>>
>>>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>>>> ---
>>>
>>> Any hint as to what commit caused this warning to show up?
>>
>> It seems below commit:
>>
>> commit e84fce0f8837496a48d11086829bdbe170358b7a
>> Author: Thierry Reding <treding@nvidia.com>
>> Date:   Thu Feb 11 18:10:48 2016 +0100
>>
>>     usb: xhci: Add NVIDIA Tegra XUSB controller driver
>>
>>     Add support for the on-chip XUSB controller present on Tegra SoCs. This
>>     controller, when loaded with external firmware, exposes an interface
>>     compliant with xHCI. This driver loads the firmware, starts the
>>     controller, and is able to service host-specific messages sent by the
>>     controller's firmware.
>>
>>     The controller also supports USB device mode as well as powergating
>>     of the SuperSpeed and host-controller logic when not in use, but
>>     support for these is not yet implemented.
>>
>>     Based on work by:
>>       Ajay Gupta <ajayg@nvidia.com>
>>       Bharath Yadav <byadav@nvidia.com>
>>       Andrew Bresticker <abrestic@chromium.org>
>>
>>     Cc: Mathias Nyman <mathias.nyman@intel.com>
>>     Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>     Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>>     Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> I've never seen this warning before. It's also a false positive in that
> technically the mailbox message will always have at least one bit set in
> "mask". However, I don't see how the compiler could know about it, given
> that the data comes from an external source, so I think this makes sense
> as a hint to the compiler. So:
> 
> Acked-by: Thierry Reding <treding@nvidia.com>
> 
> Can you provide more detail on what exact version of which compiler you
> used that triggered this? I wonder why it's never presented itself with
> the compiler that I use.

Below is the detailed version of compiler that I used.

$ sudo lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

$ arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.3-12ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.7.3 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-gnu-unique-object --disable-libmudflap --disable-libitm --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv5t --with-float=soft --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1)

> 
> Thierry
> 

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

* [PATCH] usb: xhci: remove the code build warning
@ 2018-06-05 16:35 Dongjiu Geng
  2018-06-05  8:40 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Dongjiu Geng @ 2018-06-05 16:35 UTC (permalink / raw)
  To: mathias.nyman, gregkh, thierry.reding, jonathanh, linux-usb,
	linux-tegra, linux-kernel

Initialize the 'err' variate to remove the build warning,
the warning is shown as below:

drivers/usb/host/xhci-tegra.c: In function ‘tegra_xusb_mbox_thread’:
drivers/usb/host/xhci-tegra.c:552:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
drivers/usb/host/xhci-tegra.c:482:6: note: ‘err’ was declared here

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
How to reproduce:
1. make defconfig ARCH=arm
2. make -j100 CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm

Then you can see below warnings:
drivers/usb/host/xhci-tegra.c: In function ‘tegra_xusb_mbox_thread’:
drivers/usb/host/xhci-tegra.c:552:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
drivers/usb/host/xhci-tegra.c:482:6: note: ‘err’ was declared here
---
 drivers/usb/host/xhci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
index 2c076ea..1ed87ce 100644
--- a/drivers/usb/host/xhci-tegra.c
+++ b/drivers/usb/host/xhci-tegra.c
@@ -479,7 +479,7 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
 	unsigned long mask;
 	unsigned int port;
 	bool idle, enable;
-	int err;
+	int err = 0;
 
 	memset(&rsp, 0, sizeof(rsp));
 
-- 
2.7.4

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

end of thread, other threads:[~2018-06-05  9:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05 16:35 [PATCH] usb: xhci: remove the code build warning Dongjiu Geng
2018-06-05  8:40 ` Greg KH
2018-06-05  8:54   ` gengdongjiu
2018-06-05  9:06     ` Thierry Reding
2018-06-05  9:12       ` gengdongjiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox