From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23078C433ED for ; Mon, 3 May 2021 12:57:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5D916117A for ; Mon, 3 May 2021 12:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233545AbhECM6e (ORCPT ); Mon, 3 May 2021 08:58:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:58144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233372AbhECM6V (ORCPT ); Mon, 3 May 2021 08:58:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 40DAB611C0; Mon, 3 May 2021 12:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620046648; bh=kBk7Zo6+NDEgM5HfLqkU6WXN+fEI6VrFo/57ce2FUGY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=QTKaiUY+v8C918VY0IH+nTMQxDYRYt6oL4kHbcOhNbpHlXoZvuRq7j++C8scLEChI rZHCGiSRBZ1IeoHNCC0R0lxCTcl7LaxlQlMlEXWQm5Ir5SQOwpZjI4ZnJR3v80M1lo ewf6esuaMuzWOYu8Y+S+FEZJyvrihwvyn+tzMB8caPiS4EIKSRbbxM8ZmuqENvjzHc kXXMUPob10OQ1WC5BCOZjMcyDM8uO6byATH8GLQL+ejxEoX+ONcARJeTUcBw0Nyvz7 SEqbOG8tVIr/WYwAFRyKOJ9/+7ZMK+zUisLNm3Mk2XUPaJeGUa8YgEJ0zOsvvYBteu OQJxuUYe67DHg== Subject: Re: [PATCH 51/69] dmaengine: qcom_hidma: comment platform_driver_register call To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Phillip Potter , Vinod Koul References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> <20210503115736.2104747-52-gregkh@linuxfoundation.org> From: Sinan Kaya Message-ID: <10b38be6-39e3-bfb8-743c-10227714e641@kernel.org> Date: Mon, 3 May 2021 08:57:27 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210503115736.2104747-52-gregkh@linuxfoundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/3/2021 7:57 AM, Greg Kroah-Hartman wrote: > From: Phillip Potter > > 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 > Cc: Vinod Koul > Signed-off-by: Phillip Potter > Signed-off-by: Greg Kroah-Hartman > --- > 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