[PATCH 1/5] usb: add Atmel USBA UDC DT support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon May 20 06:12:37 EDT 2013


> >
> >-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.



More information about the linux-arm-kernel mailing list