From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Suwan Kim <suwan.kim027@gmail.com>
Cc: stern@rowland.harvard.edu, linux-usb@vger.kernel.org,
mathias.nyman@linux.intel.com
Subject: usb: core: endpoint: Add error messages for usb_create_ep_devs()
Date: Mon, 21 Jan 2019 15:35:34 +0100 [thread overview]
Message-ID: <20190121143534.GA27460@kroah.com> (raw)
On Mon, Jan 21, 2019 at 11:30:55PM +0900, Suwan Kim wrote:
> usb_create_ep_devs() returns error code if an error occurs. But
> usb_new_device() and create_intf_ep_devs() which use usb_create_ep_devs()
> to create endpoint devices ignore the error and cut the propagation
> of the error when usb_create_ep_devs() fails. So, usb_create_ep_devs()
> prints an error message for debugging or notification purposes if an
> error occurs.
>
> Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
> ---
> drivers/usb/core/endpoint.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
> index 1c2c04079676..ad3902c023d9 100644
> --- a/drivers/usb/core/endpoint.c
> +++ b/drivers/usb/core/endpoint.c
> @@ -182,6 +182,7 @@ int usb_create_ep_devs(struct device *parent,
>
> ep_dev = kzalloc(sizeof(*ep_dev), GFP_KERNEL);
> if (!ep_dev) {
> + dev_err(parent, "endpoint device alloc failed\n");
kzalloc() prints out an error if it fails, why print out it again here?
> retval = -ENOMEM;
> goto exit;
> }
> @@ -194,8 +195,10 @@ int usb_create_ep_devs(struct device *parent,
> dev_set_name(&ep_dev->dev, "ep_%02x", endpoint->desc.bEndpointAddress);
>
> retval = device_register(&ep_dev->dev);
> - if (retval)
> + if (retval) {
> + dev_err(parent, "endpoint device register failed\n");
Doesn't device_add() provide an error if this fails? If not, what can
we do about it here?
And even if you do want this message, it's not the parent that failed to
register, so this might be a bit misleading of a message.
What problem are you having that you are trying to fix here? Have you
seen the call to device_register() fail for an endpoint?
thanks,
greg k-h
next reply other threads:[~2019-01-21 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 14:35 Greg Kroah-Hartman [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-01-22 14:19 usb: core: endpoint: Add error messages for usb_create_ep_devs() Suwan Kim
2019-01-21 14:30 Suwan Kim
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=20190121143534.GA27460@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=stern@rowland.harvard.edu \
--cc=suwan.kim027@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).