devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
To: Bo Shen <voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 1/5] usb: add Atmel USBA UDC DT support
Date: Mon, 20 May 2013 12:12:37 +0200	[thread overview]
Message-ID: <20130520101237.GA9937@game.jcrosoft.org> (raw)
In-Reply-To: <519997CA.8010503-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

> >
> >-static int __init usba_udc_probe(struct platform_device *pdev)
> >+#ifdef CONFIG_OF
> >+static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
> >+						    struct usba_udc *udc)
> >+{
> >+	u32 val;
> >+	const char *name;
> >+	enum of_gpio_flags flags;
> >+	struct device_node *np = pdev->dev.of_node;
> >+	struct device_node *pp;
> >+	int i, ret;
> >+	struct usba_ep *eps, *ep;
> >+
> >+	udc->num_ep = 0;
> >+
> >+	udc->vbus_pin = of_get_named_gpio_flags(np, "atmel,vbus-gpio", 0,
> >+						&flags);
> >+	udc->vbus_pin_inverted = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
> >+
> >+	pp = NULL;
> >+	while ((pp = of_get_next_child(np, pp)))
> >+		udc->num_ep++;
> >+
> >+	eps = devm_kzalloc(&pdev->dev, sizeof(struct usba_ep) * udc->num_ep,
> >+			   GFP_KERNEL);
> 
> Using devm_kzalloc will cause issue when build as modules, and load
> and unload this driver, the second time unload, it will come out
> following segment fault, log as following. Using kzalloc will fix
> it.

no devm_kzalloc is the right one to use

if there is a this not in the drivers and kzalloc is not the solution
we need to find the real reason as devm_xxx are used everywhere by now

Best Regards,
J.

  parent reply	other threads:[~2013-05-20 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17 14:14 [PATCH 0/5 v3] ARM: at91: dt: add USBA support Jean-Christophe PLAGNIOL-VILLARD
     [not found] ` <20130517141443.GB16804-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2013-05-17 14:42   ` [PATCH 1/5] usb: add Atmel USBA UDC DT support Jean-Christophe PLAGNIOL-VILLARD
2013-05-17 14:42     ` [PATCH 2/5] ARM: at91: sam9x5 add udc " Jean-Christophe PLAGNIOL-VILLARD
2013-05-17 14:42     ` [PATCH 3/5] ARM: at91: sam9x5ek " Jean-Christophe PLAGNIOL-VILLARD
2013-05-17 14:42     ` [PATCH 4/5] ARM: at91: sam9g45 " Jean-Christophe PLAGNIOL-VILLARD
2013-05-17 14:42     ` [PATCH 5/5] ARM: at91: sam9m10g45ek " Jean-Christophe PLAGNIOL-VILLARD
     [not found]     ` <1368801730-31383-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2013-05-20  3:26       ` [PATCH 1/5] usb: add Atmel USBA UDC " Bo Shen
     [not found]         ` <519997CA.8010503-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2013-05-20 10:12           ` Jean-Christophe PLAGNIOL-VILLARD [this message]
     [not found]             ` <20130520101237.GA9937-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2013-05-20 15:44               ` Jean-Christophe PLAGNIOL-VILLARD

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=20130520101237.GA9937@game.jcrosoft.org \
    --to=plagnioj-sclmfoaustbwk0htik3j/w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=voice.shen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
    /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).