From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Felipe Balbi <balbi@ti.com>
Cc: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-usb@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Gregory Clement <gregory.clement@free-electrons.com>
Subject: Re: [PATCH] usb: gadget: atmel_usba: fix crash when no endpoint are specified
Date: Fri, 28 Feb 2014 15:35:42 +0100 [thread overview]
Message-ID: <53109EBE.4020900@atmel.com> (raw)
In-Reply-To: <1393515733-15764-1-git-send-email-alexandre.belloni@free-electrons.com>
On 27/02/2014 16:42, Alexandre Belloni :
> If no endpoints are present in the device tree, the kernel will cras hwith the
s/cras hwith/crash with/
> following error:
>
> Unable to handle kernel paging request at virtual address 00101008
> [...]
> [<c0222ff4>] (composite_dev_prepare) from [<c022326c>] (composite_bind+0x5c/0x190)
> [<c022326c>] (composite_bind) from [<c021ff8c>] (udc_bind_to_driver+0x48/0xf0)
> [<c021ff8c>] (udc_bind_to_driver) from [<c02208e0>] (usb_gadget_probe_driver+0x7c/0xa0)
> [<c02208e0>] (usb_gadget_probe_driver) from [<c0008970>] (do_one_initcall+0x94/0x140)
> [<c0008970>] (do_one_initcall) from [<c04b4b50>] (kernel_init_freeable+0xec/0x1b4)
> [<c04b4b50>] (kernel_init_freeable) from [<c0376cc4>] (kernel_init+0x8/0xe4)
> [<c0376cc4>] (kernel_init) from [<c0009590>] (ret_from_fork+0x14/0x24)
> Code: e5950014 e1a04001 e5902008 e3a010d0 (e5922008)
> ---[ end trace 35c74bdd89b373d0 ]---
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> This checks for that case and returns an error, not allowing the driver to be
> loaded with no endpoints.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/usb/gadget/atmel_usba_udc.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 52771d4c44bc..e3e0c8ff242e 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -1914,6 +1914,12 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
> i++;
> }
>
> + if (i == 0) {
> + dev_err(&pdev->dev, "of_probe: no endpoint specified\n");
> + ret = -EINVAL;
> + goto err;
> + }
> +
It is better for debugging when creating a DT for a new SoC. So, okay.
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> return eps;
> err:
> return ERR_PTR(ret);
>
--
Nicolas Ferre
next prev parent reply other threads:[~2014-02-28 14:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-27 15:42 [PATCH] usb: gadget: atmel_usba: fix crash when no endpoint are specified Alexandre Belloni
2014-02-28 14:35 ` Nicolas Ferre [this message]
2014-03-03 16:46 ` Alexandre Belloni
2014-03-03 16:47 ` Felipe Balbi
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=53109EBE.4020900@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=maxime.ripard@free-electrons.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