Re: [PATCH] x86/platform/goldfish: add a check for platform_device_register_simple

From: Andy Shevchenko
Date: Mon Dec 09 2019 - 12:55:15 EST


On Mon, Dec 9, 2019 at 6:22 PM Chuhong Yuan <hslester96@xxxxxxxxx> wrote:
>
> goldfish_init() misses a check for platform_device_register_simple().
> Add a check to fix it.

Thanks for a patch. My comments below.

> static int __init goldfish_init(void)
> {
> + struct platform_device *pdev;
> +
> if (!goldfish_enable)
> return -ENODEV;
>
> - platform_device_register_simple("goldfish_pdev_bus", -1,
> - goldfish_pdev_bus_resources, 2);

> + pdev = platform_device_register_simple("goldfish_pdev_bus", -1,

Perhaps idea for a separate patch or maybe here:
-1 -> PLATFORM_DEVID_NONE

> + goldfish_pdev_bus_resources, 2);

> + if (IS_ERR(pdev))
> + return PTR_ERR(pdev);
> +
> return 0;

This can use PTR_ERR_OR_ZERO() macro instead.

> }


--
With Best Regards,
Andy Shevchenko