2019-03-26 20:17:03

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH] USB/xHCI: Remove returned value 'status' since never used

The returned value in status has never been used since
commit 4296c70a5ec3 ("USB/xHCI: Enable USB 3.0 hub remote wakeup.")
So remove 'status' completely.

Remove warning (W=1):

drivers/usb/core/hub.c:3671:8: warning: variable 'status' set but not used [-Wunused-but-set-variable]

Cc: Sarah Sharp <[email protected]>
Signed-off-by: Mathieu Malaterre <[email protected]>
---
drivers/usb/core/hub.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8d4631c81b9f..15a2934dc29d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3668,7 +3668,6 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
struct usb_hub *hub = usb_get_intfdata(intf);
struct usb_device *hdev = hub->hdev;
unsigned port1;
- int status;

/*
* Warn if children aren't already suspended.
@@ -3702,12 +3701,12 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) {
/* Enable hub to send remote wakeup for all ports. */
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
- status = set_port_feature(hdev,
- port1 |
- USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
- USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
- USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
- USB_PORT_FEAT_REMOTE_WAKE_MASK);
+ set_port_feature(hdev,
+ port1 |
+ USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
+ USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
+ USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
+ USB_PORT_FEAT_REMOTE_WAKE_MASK);
}
}

--
2.20.1



2019-03-27 11:22:27

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] USB/xHCI: Remove returned value 'status' since never used


On 3/27/2019 1:45 AM, Mathieu Malaterre wrote:
> The returned value in status has never been used since
> commit 4296c70a5ec3 ("USB/xHCI: Enable USB 3.0 hub remote wakeup.")
> So remove 'status' completely.
>
> Remove warning (W=1):
>
> drivers/usb/core/hub.c:3671:8: warning: variable 'status' set but not used [-Wunused-but-set-variable]
>
> Cc: Sarah Sharp <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> drivers/usb/core/hub.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 8d4631c81b9f..15a2934dc29d 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3668,7 +3668,6 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
> struct usb_hub *hub = usb_get_intfdata(intf);
> struct usb_device *hdev = hub->hdev;
> unsigned port1;
> - int status;
>
> /*
> * Warn if children aren't already suspended.
> @@ -3702,12 +3701,12 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
> if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) {
> /* Enable hub to send remote wakeup for all ports. */
> for (port1 = 1; port1 <= hdev->maxchild; port1++) {
> - status = set_port_feature(hdev,
> - port1 |
> - USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
> - USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
> - USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
> - USB_PORT_FEAT_REMOTE_WAKE_MASK);


should not we check return value instead of removing it.

Thanks,
Mukesh

> + set_port_feature(hdev,
> + port1 |
> + USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
> + USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
> + USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
> + USB_PORT_FEAT_REMOTE_WAKE_MASK);
> }
> }
>

2019-03-27 18:28:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] USB/xHCI: Remove returned value 'status' since never used

On Tue, Mar 26, 2019 at 09:15:57PM +0100, Mathieu Malaterre wrote:
> The returned value in status has never been used since
> commit 4296c70a5ec3 ("USB/xHCI: Enable USB 3.0 hub remote wakeup.")
> So remove 'status' completely.
>
> Remove warning (W=1):
>
> drivers/usb/core/hub.c:3671:8: warning: variable 'status' set but not used [-Wunused-but-set-variable]
>
> Cc: Sarah Sharp <[email protected]>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> drivers/usb/core/hub.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)

Why do you have xhci in your subject line? Shouldn't it be "USB: hub:"?

Please fix up, thanks.

greg k-h

2019-03-27 19:41:52

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2] USB: hub: Remove returned value 'status' since never used

The returned value in status has never been used since
commit 4296c70a5ec3 ("USB/xHCI: Enable USB 3.0 hub remote wakeup.")
So remove 'status' completely.

Remove warning (W=1):

drivers/usb/core/hub.c:3671:8: warning: variable 'status' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: change subject prefix from USB/xHCI: to USB: hub:

drivers/usb/core/hub.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8d4631c81b9f..15a2934dc29d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3668,7 +3668,6 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
struct usb_hub *hub = usb_get_intfdata(intf);
struct usb_device *hdev = hub->hdev;
unsigned port1;
- int status;

/*
* Warn if children aren't already suspended.
@@ -3702,12 +3701,12 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) {
/* Enable hub to send remote wakeup for all ports. */
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
- status = set_port_feature(hdev,
- port1 |
- USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
- USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
- USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
- USB_PORT_FEAT_REMOTE_WAKE_MASK);
+ set_port_feature(hdev,
+ port1 |
+ USB_PORT_FEAT_REMOTE_WAKE_CONNECT |
+ USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT |
+ USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT,
+ USB_PORT_FEAT_REMOTE_WAKE_MASK);
}
}

--
2.20.1