]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usbip: vhci_hcd: fix return value check in add_platform_device()
authorWei Yongjun <weiyj.lk@gmail.com>
Fri, 12 Aug 2016 11:22:22 +0000 (11:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 14:25:59 +0000 (16:25 +0200)
In case of error, the function platform_device_register_simple() returns
ERR_PTR() and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/vhci_hcd.c

index 96f2dacb27fac777bba3fb16c013a601f51d3284..03eccf29ace068f07597931799fb6b57254c5d7b 100644 (file)
@@ -1211,8 +1211,8 @@ static int add_platform_device(int id)
                dev_nr = id;
 
        pdev = platform_device_register_simple(driver_name, dev_nr, NULL, 0);
-       if (pdev == NULL)
-               return -ENODEV;
+       if (IS_ERR(pdev))
+               return PTR_ERR(pdev);
 
        *(vhci_pdevs + id) = pdev;
        return 0;