Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3931577pxb; Tue, 10 Nov 2020 04:00:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5hGwG70ZLfuyf+TT0G3O0yOeftfwuKDZnayue/260aKXm7Vv7zxTwhy4FT9B5u33TuJ/W X-Received: by 2002:a17:906:4059:: with SMTP id y25mr19553808ejj.498.1605009608279; Tue, 10 Nov 2020 04:00:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605009608; cv=none; d=google.com; s=arc-20160816; b=d/CswZWLE9FCajzz99SRp0sIjX3U2rng0rOs8iehpvPKJXHSSF2LvzeGsGYl5SKYUv CfVY73L3Rbz/D44+0QF9iz6eFrzCP+oycE+2CJQqwwcaTOeGmKnnAitSHBvmyFlxilZ9 GqxECruqV9Rw/RVJwA8i2Mty2uCaYF6F9BPwQr0z/fNZl7z/sRoUZmnwd88z3y7fA7Do Ph8EOsw8OgnmWyeqoRShqLaiD6b7JlPkMNya2riOIIFWBQjEadEZG+23eyfscolqOBtH F5o0XJ178n17FmwHqyEAhmwfZfBpVaSSwDmJhQYCkmuszV9lu158JbVHR7x7kJnMVxvk /LLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=G8s9uL2Dc+IcKY0Hu0WI3UboxAj5L6Mx3tsnUXfA/EU=; b=vzndN4b+mfUzypGeME9eL9FpCSu/sKtImnfYsHm5gqNQMm4lDETvbGxi05kcs/mT8r 9Hv19zOQ2lCGh1hGoEBDoBMD0YjuFj1oy5axDMZr80kC6eDsJxLsRI57zNecgh5YLTwu j1VcNLvm3cIVk83ywopwWxidEyOAgZA6DlDEzIWa+N57sdfJfh9wlKb8TUbC30uDeMES 1Q162FDoVvbr5s39l4dytQPRaqfdx2PUnhKa5gq1NxFQet1txtx+1Bfgod1iXk1WA0sA mVuQkck7UTrSVcUaXMm3bv/+z8XR/3ngXgrcULa8k0Bx1T0BNHoF5vQcoSRsEdogeWw7 86jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si9066286edr.490.2020.11.10.03.59.45; Tue, 10 Nov 2020 04:00:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729555AbgKJL6V (ORCPT + 99 others); Tue, 10 Nov 2020 06:58:21 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:2429 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgKJL6V (ORCPT ); Tue, 10 Nov 2020 06:58:21 -0500 Received: from dggeme755-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4CVmb50XQBz53g0; Tue, 10 Nov 2020 19:58:09 +0800 (CST) Received: from [10.140.157.68] (10.140.157.68) by dggeme755-chm.china.huawei.com (10.3.19.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Tue, 10 Nov 2020 19:58:16 +0800 Subject: Re: [PATCH v2] clk: hisilicon: Free clk_data and unmap region obtained by of_iomap To: Markus Elfring , CC: , , Michael Turquette , Stephen Boyd References: <20201109180920.43193-1-gengdongjiu@huawei.com> From: Dongjiu Geng Message-ID: <3252231f-dfb9-789f-e164-11d0e579defe@huawei.com> Date: Tue, 10 Nov 2020 19:58:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.140.157.68] X-ClientProxiedBy: dggeme714-chm.china.huawei.com (10.1.199.110) To dggeme755-chm.china.huawei.com (10.3.19.101) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/10 1:54, Markus Elfring wrote: > … >> +++ b/drivers/clk/hisilicon/clk-hi3620.c > … >> @@ -478,6 +478,10 @@ static void __init hi3620_mmc_clk_init(struct device_node *node) >> >> clk_data->clk_num = num; >> of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); >> +free_clk_data: >> + kfree(clk_data); > … > > * Should any system resources be kept allocated if the execution > of this function implementation succeeded? > > * How do you think about to add the statement “return;” > after the call of the function “of_clk_add_provider”? > > * Should another return value be also checked here? sure. > > See also: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/clk.c?id=f8394f232b1eab649ce2df5c5f15b0e528c92091#n4414 > https://elixir.bootlin.com/linux/v5.10-rc2/source/drivers/clk/clk.c#L4414 > > * Would you like to use the function “of_clk_add_hw_provider” instead? How about we still use of_clk_add_provider()? It doesn't seem to make difference using of_clk_add_hw_provider(). > > Regards, > Markus