Re: usbip: vudc: Add VUDC main file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 04/28/2016 09:21 PM, Dan Carpenter wrote:
> Hello Igor Kotrasinski,
> 
> The patch 80fd9cd52de6: "usbip: vudc: Add VUDC main file" from Mar 8,
> 2016, leads to the following static checker warning:
> 
> 	drivers/usb/usbip/vudc_main.c:88 init()
> 	warn: perhaps platform_device_put() was intended here?
> 
> drivers/usb/usbip/vudc_main.c
>     56          retval = platform_driver_register(&vudc_driver);
>     57          if (retval < 0)
>     58                  goto out;
>     59  
>     60          for (i = 0; i < vudc_number; i++) {
>     61                  udc_dev = alloc_vudc_device(i);
>     62                  if (!udc_dev) {
>     63                          retval = -ENOMEM;
>     64                          goto cleanup;
>     65                  }
>     66  
>     67                  retval = platform_device_add(udc_dev->pdev);
>     68                  if (retval < 0) {
>     69                          put_vudc_device(udc_dev);
>     70                          goto cleanup;
>     71                  }
>     72  
>     73                  list_add_tail(&udc_dev->dev_entry, &vudc_devices);
>     74                  if (!platform_get_drvdata(udc_dev->pdev)) {
>     75                          /*
>     76                           * The udc was added successfully but its probe
>     77                           * function failed for some reason.
>     78                           */
>     79                          retval = -EINVAL;
>     80                          goto cleanup;
>     81                  }
>     82          }
>     83          goto out;
>     84  
>     85  cleanup:
>     86          list_for_each_entry_safe(udc_dev, udc_dev2, &vudc_devices, dev_entry) {
>     87                  list_del(&udc_dev->dev_entry);
>     88                  platform_device_del(udc_dev->pdev);
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> I had to look through my git log to find why Smatch generates this
> warning.  Apparently the check was inspired by e9a1c5129de1caf
> "wm8350-regulator: fix wm8350_register_regulator error handling".  I
> wrote it in 2010 and this is the first time this warning has ever been
> triggered.  I'm very excited!  But I have no idea if it's a false
> positive or a real bug.

I'm sorry to tell you this but unfortunately this is a false positive:(
Just please take a look one line below;)

> 
>     89                  put_vudc_device(udc_dev);

and what this function does is simply:

void put_vudc_device(struct vudc_device *udc_dev)
{
	platform_device_put(udc_dev->pdev);
	kfree(udc_dev);
}


Cheers,
-- 
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux