staging: drm/imx: fix return value check in ipu_add_subdevice_pdata()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Wed, 30 Oct 2013 03:15:51 +0000 (11:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Oct 2013 17:17:33 +0000 (10:17 -0700)
In case of error, the function platform_device_register_data() 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/imx-drm/ipu-v3/ipu-common.c

index 77a0c65a3dbe650b8dee5261b7c3d2447639afbf..7a22ce619ed264ba536de785650700b02f6d3ef3 100644 (file)
@@ -1006,7 +1006,7 @@ static int ipu_add_subdevice_pdata(struct device *dev,
        pdev = platform_device_register_data(dev, reg->name, ipu_client_id++,
                        &reg->pdata, sizeof(struct ipu_platform_reg));
 
-       return pdev ? 0 : -EINVAL;
+       return PTR_ERR_OR_ZERO(pdev);
 }
 
 static int ipu_add_client_devices(struct ipu_soc *ipu)