Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: qcom_hidma: comment platform_driver_register call

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.

Acked-By: Vinod Koul <vkoul@kernel.org>
Acked-By: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210503115736.2104747-52-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Phillip Potter and committed by
Greg Kroah-Hartman
4df2a8b0 43ed0fcf

+14
+14
drivers/dma/qcom/hidma_mgmt.c
··· 418 418 hidma_mgmt_of_populate_channels(child); 419 419 } 420 420 #endif 421 + /* 422 + * We do not check for return value here, as it is assumed that 423 + * platform_driver_register must not fail. The reason for this is that 424 + * the (potential) hidma_mgmt_of_populate_channels calls above are not 425 + * cleaned up if it does fail, and to do this work is quite 426 + * complicated. In particular, various calls of of_address_to_resource, 427 + * of_irq_to_resource, platform_device_register_full, of_dma_configure, 428 + * and of_msi_configure which then call other functions and so on, must 429 + * be cleaned up - this is not a trivial exercise. 430 + * 431 + * Currently, this module is not intended to be unloaded, and there is 432 + * no module_exit function defined which does the needed cleanup. For 433 + * this reason, we have to assume success here. 434 + */ 421 435 platform_driver_register(&hidma_mgmt_driver); 422 436 423 437 return 0;