Procházet zdrojové kódy

usb: phy: phy-generic: fix return value check in usb_nop_xceiv_register()

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 <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Wei Yongjun před 11 roky
rodič
revize
e8d68f88bc
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      drivers/usb/phy/phy-generic.c

+ 2 - 1
drivers/usb/phy/phy-generic.c

@@ -48,8 +48,9 @@ void usb_nop_xceiv_register(void)
 	if (pd)
 		return;
 	pd = platform_device_register_simple("usb_phy_gen_xceiv", -1, NULL, 0);
-	if (!pd) {
+	if (IS_ERR(pd)) {
 		pr_err("Unable to register generic usb transceiver\n");
+		pd = NULL;
 		return;
 	}
 }