Commit 57401d5e authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

phy: error handling for platform_device_register_simple()

platform_device_register_simple() returns ERR_PTR() and not NULL.

Found by smatch (http://repo.or.cz/w/smatch.git).  Compile tested.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3384901f
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/phy_fixed.h> #include <linux/phy_fixed.h>
#include <linux/err.h>
#define MII_REGS_NUM 29 #define MII_REGS_NUM 29
...@@ -207,8 +208,8 @@ static int __init fixed_mdio_bus_init(void) ...@@ -207,8 +208,8 @@ static int __init fixed_mdio_bus_init(void)
int ret; int ret;
pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0); pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0);
if (!pdev) { if (IS_ERR(pdev)) {
ret = -ENOMEM; ret = PTR_ERR(pdev);
goto err_pdev; goto err_pdev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment