[PATCH v2 1/3] drm/loongson: Add a helper for creating child devices

Markus Elfring Markus.Elfring at web.de
Mon May 27 09:07:42 UTC 2024


> In some display subsystems, the functionality of a PCIe device may too

                                                                 might be?


…
> into child devices can helpful to …

                         be?


> Another benefit is that we could migrate the dependency on exterinal

                                                             external?


…
> and rising cyclic dependency problems if not process correctly.

                                               processed?


…
> driver to create sub-devices for it. The manually created decice acts as

                                                            device?


> agents for the principal part, migrate the potential issue to submodule.

  an agent?


Please improve your change descriptions considerably.


…
> +++ b/drivers/gpu/drm/loongson/loongson_device.c
…
> @@ -100,3 +101,44 @@ lsdc_device_probe(struct pci_dev *pdev, enum loongson_chip_id chip_id)
>  {
>  	return __chip_id_desc_table[chip_id];
>  }
> +
> +int loongson_create_platform_device(struct device *parent,
> +				    const char *name, int id,
> +				    struct resource *pres,
> +				    void *data,
> +				    struct platform_device **ppdev)
> +{
…
> +		ret = platform_device_add_resources(pdev, pres, 1);
> +		if (ret) {
> +			platform_device_put(pdev);
> +			return ret;
> +		}
…
> +	ret = platform_device_add(pdev);
> +	if (ret) {
> +		platform_device_put(pdev);
> +		return ret;
> +	}
…

Please use a goto chain for common exception handling.
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources

Regards,
Markus


More information about the dri-devel mailing list