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().
Unified · Split
| @@ -438,8 +438,8 @@ static int __init vgem_init(void) · 437 unmodified lines | |||
| 438 | 438 | ||
| 439 | vgem_device->platform = | 439 | vgem_device->platform = |
| 440 | platform_device_register_simple("vgem", -1, NULL, 0); | 440 | platform_device_register_simple("vgem", -1, NULL, 0); |
| 441 | if (!vgem_device->platform) { | 441 | if (IS_ERR(vgem_device->platform)) { |
| 442 | ret = -ENODEV; | 442 | ret = PTR_ERR(vgem_device->platform); |
| 443 | goto out_fini; | 443 | goto out_fini; |
| 444 | } | 444 | } |
| 445 | 445 | ||