Explorar o código

usbip: vhci_hcd: fix return value check in add_platform_device()

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>
Wei Yongjun %!s(int64=9) %!d(string=hai) anos
pai
achega
6e958051cb
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      drivers/usb/usbip/vhci_hcd.c

+ 2 - 2
drivers/usb/usbip/vhci_hcd.c

@@ -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;