The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>,
	Griffin Kroah-Hartman <griffin@kroah.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: core: Strengthen error handling in hub_hub_status()
Date: Tue, 14 Jul 2026 19:48:14 +0200	[thread overview]
Message-ID: <f5e4f3d4-34f8-46b9-90e2-4f21e90983b7@suse.com> (raw)
In-Reply-To: <f66a5507-5e83-424f-9c11-15b1882be499@rowland.harvard.edu>

On 14.07.26 18:32, Alan Stern wrote:

>> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
>> index 5262e11c12cd..0d2166b8923a 100644
>> --- a/drivers/usb/core/hub.c
>> +++ b/drivers/usb/core/hub.c
>> @@ -991,10 +991,12 @@ static int hub_hub_status(struct usb_hub *hub,
>>   
>>   	mutex_lock(&hub->status_mutex);
>>   	ret = get_hub_status(hub->hdev, &hub->status->hub);
>> -	if (ret < 0) {
>> +	if (ret < sizeof(hub->status->hub)) {
>>   		if (ret != -ENODEV)
>>   			dev_err(hub->intfdev,
>>   				"%s failed (err = %d)\n", __func__, ret);
>> +		if (ret >= 0)
>> +			ret = -EIO;
> 
> It would be better to put these two lines above the preceding test.
> That way it won't print confusing things like "hub_hub_status failed
> (err = 2)".
I am afraid I have to disagree. We would in effect say that get_hub_status()
has returned -EIO. That is simply not true.

	Regards
		Oliver


  reply	other threads:[~2026-07-14 17:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  9:04 [PATCH] usb: core: Strengthen error handling in hub_hub_status() Griffin Kroah-Hartman
2026-07-14 16:32 ` Alan Stern
2026-07-14 17:48   ` Oliver Neukum [this message]
2026-07-14 18:59     ` Alan Stern
2026-07-17  9:48   ` Greg Kroah-Hartman
2026-07-17 15:45     ` Alan Stern

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=f5e4f3d4-34f8-46b9-90e2-4f21e90983b7@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=griffin@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox