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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 EC629C47091 for ; Mon, 24 May 2021 15:10:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D653160698 for ; Mon, 24 May 2021 15:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235451AbhEXPKl (ORCPT ); Mon, 24 May 2021 11:10:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234006AbhEXPCH (ORCPT ); Mon, 24 May 2021 11:02:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 33B6C6148E; Mon, 24 May 2021 14:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621867820; bh=VHyJePAyYhLaCiPGvFQJSh66K3zPSB0orscaqg9bJV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mZFATz/xIhxTr977B22KXA7UTkjFJf+igrmakq+++JyWvP6tlaXz0umozmbBpVRjI TEHCeL7E+KE2f+Gut8byDEZaZwOlHx3VUm9BO70LUIOv70Ezv5CJRR2IOJ2YiL0y2a Pt+I2LYvy+yRDMUIeQroLuxCdN1rr6TrPR4M3LGe53UBcI7tvPj8/oc9J9K3Aql7W1 /Y2Mb65PNJCcKdiSfQJiEvUyFl4s1lS1QlcJQnhZlBwdyL05LOvPkpOdaWL8/kDAPr JUFZY8XmrQEYxZBB7oRq7/TmqGjGnRqO8B1czjwPiqm/2w4xLomtG5SkapS9lom80i b6ppYQjnTUmbw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Phillip Potter , Vinod Koul , Sinan Kaya , Greg Kroah-Hartman , Sasha Levin , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 09/25] dmaengine: qcom_hidma: comment platform_driver_register call Date: Mon, 24 May 2021 10:49:52 -0400 Message-Id: <20210524145008.2499049-9-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210524145008.2499049-1-sashal@kernel.org> References: <20210524145008.2499049-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phillip Potter [ Upstream commit 4df2a8b0ad634d98a67e540a4e18a60f943e7d9f ] 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 Acked-By: Sinan Kaya Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20210503115736.2104747-52-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 d64edeb6771a..f9640e37b139 100644 --- a/drivers/dma/qcom/hidma_mgmt.c +++ b/drivers/dma/qcom/hidma_mgmt.c @@ -423,6 +423,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; -- 2.30.2