Преглед на файлове

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 преди 9 години
родител
ревизия
6e958051cb
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  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;
 		dev_nr = id;
 
 
 	pdev = platform_device_register_simple(driver_name, dev_nr, NULL, 0);
 	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;
 	*(vhci_pdevs + id) = pdev;
 	return 0;
 	return 0;