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>
This commit is contained in:
parent
d35cbed604
commit
6e958051cb
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue