[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10b38be6-39e3-bfb8-743c-10227714e641@kernel.org>
Date: Mon, 3 May 2021 08:57:27 -0400
From: Sinan Kaya <okaya@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Cc: Phillip Potter <phil@...lpotter.co.uk>,
Vinod Koul <vkoul@...nel.org>
Subject: Re: [PATCH 51/69] dmaengine: qcom_hidma: comment
platform_driver_register call
On 5/3/2021 7:57 AM, Greg Kroah-Hartman wrote:
> From: Phillip Potter <phil@...lpotter.co.uk>
>
> Place a comment in hidma_mgmt_init explaining why success must
> currently be assumed, due to the cleanup issue that would need to
> be considered were this module ever to be unloadable or were this
> platform_driver_register call ever to fail.
>
> Cc: Sinan Kaya <okaya@...nel.org>
> Cc: Vinod Koul <vkoul@...nel.org>
> Signed-off-by: Phillip Potter <phil@...lpotter.co.uk>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> drivers/dma/qcom/hidma_mgmt.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
> index fe87b01f7a4e..62026607f3f8 100644
> --- a/drivers/dma/qcom/hidma_mgmt.c
> +++ b/drivers/dma/qcom/hidma_mgmt.c
> @@ -418,6 +418,20 @@ static int __init hidma_mgmt_init(void)
> hidma_mgmt_of_populate_channels(child);
> }
> #endif
> + /*
> + * We do not check for return value here, as it is assumed that
> + * platform_driver_register must not fail. The reason for this is that
> + * the (potential) hidma_mgmt_of_populate_channels calls above are not
> + * cleaned up if it does fail, and to do this work is quite
> + * complicated. In particular, various calls of of_address_to_resource,
> + * of_irq_to_resource, platform_device_register_full, of_dma_configure,
> + * and of_msi_configure which then call other functions and so on, must
> + * be cleaned up - this is not a trivial exercise.
> + *
> + * Currently, this module is not intended to be unloaded, and there is
> + * no module_exit function defined which does the needed cleanup. For
> + * this reason, we have to assume success here.
> + */
> platform_driver_register(&hidma_mgmt_driver);
>
> return 0;
>
Acked-By: Sinan Kaya <okaya@...nel.org>
Powered by blists - more mailing lists