From: Marijn Suijten <marijn.suijten@somainline.org> To: phone-devel@vger.kernel.org, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Stephen Boyd <sboyd@kernel.org> Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>, Konrad Dybcio <konrad.dybcio@somainline.org>, Martin Botka <martin.botka@somainline.org>, Jami Kettunen <jami.kettunen@somainline.org>, Marijn Suijten <marijn.suijten@somainline.org>, Michael Turquette <mturquette@baylibre.com>, Rob Clark <robdclark@gmail.com>, Abhinav Kumar <quic_abhinavk@quicinc.com>, Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, Rajeev Nandan <quic_rajeevny@quicinc.com>, Vladimir Lypak <vladimir.lypak@gmail.com>, Jonathan Marek <jonathan@marek.ca>, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v3 05/11] drm/msm/dsi_phy_28nm_8960: Use stack memory for temporary clock names Date: Thu, 30 Jun 2022 00:53:25 +0200 [thread overview] Message-ID: <20220629225331.357308-6-marijn.suijten@somainline.org> (raw) In-Reply-To: <20220629225331.357308-1-marijn.suijten@somainline.org> The clock names formatted into the hw_clk's init structure are only used for the duration of the registration function where they are kstrdup'ed, making it unnecessary to keep the allocations alive for the duration of the device (through devm). Just like the other DSI PHY PLL clock trees, use a stack-local char array and save on memory outside of the pll_28nm_register function. Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c index af630b8eb9f3..24bac401b210 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c @@ -383,7 +383,7 @@ static int dsi_28nm_pll_restore_state(struct msm_dsi_phy *phy) static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **provided_clocks) { - char *clk_name, *parent_name, *vco_name; + char clk_name[32], parent_name[32], vco_name[32]; struct clk_init_data vco_init = { .parent_data = &(const struct clk_parent_data) { .fw_name = "ref", @@ -404,18 +404,6 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov if (!bytediv) return -ENOMEM; - vco_name = devm_kzalloc(dev, 32, GFP_KERNEL); - if (!vco_name) - return -ENOMEM; - - parent_name = devm_kzalloc(dev, 32, GFP_KERNEL); - if (!parent_name) - return -ENOMEM; - - clk_name = devm_kzalloc(dev, 32, GFP_KERNEL); - if (!clk_name) - return -ENOMEM; - snprintf(vco_name, 32, "dsi%dvco_clk", pll_28nm->phy->id); vco_init.name = vco_name; -- 2.37.0
WARNING: multiple messages have this Message-ID (diff)
From: Marijn Suijten <marijn.suijten@somainline.org> To: phone-devel@vger.kernel.org, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Stephen Boyd <sboyd@kernel.org> Cc: freedreno@lists.freedesktop.org, Jonathan Marek <jonathan@marek.ca>, Jami Kettunen <jami.kettunen@somainline.org>, Rajeev Nandan <quic_rajeevny@quicinc.com>, Michael Turquette <mturquette@baylibre.com>, Vladimir Lypak <vladimir.lypak@gmail.com>, Konrad Dybcio <konrad.dybcio@somainline.org>, Abhinav Kumar <quic_abhinavk@quicinc.com>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>, Martin Botka <martin.botka@somainline.org>, ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>, Marijn Suijten <marijn.suijten@somainline.org>, Sean Paul <sean@poorly.run>, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v3 05/11] drm/msm/dsi_phy_28nm_8960: Use stack memory for temporary clock names Date: Thu, 30 Jun 2022 00:53:25 +0200 [thread overview] Message-ID: <20220629225331.357308-6-marijn.suijten@somainline.org> (raw) In-Reply-To: <20220629225331.357308-1-marijn.suijten@somainline.org> The clock names formatted into the hw_clk's init structure are only used for the duration of the registration function where they are kstrdup'ed, making it unnecessary to keep the allocations alive for the duration of the device (through devm). Just like the other DSI PHY PLL clock trees, use a stack-local char array and save on memory outside of the pll_28nm_register function. Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c index af630b8eb9f3..24bac401b210 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c @@ -383,7 +383,7 @@ static int dsi_28nm_pll_restore_state(struct msm_dsi_phy *phy) static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **provided_clocks) { - char *clk_name, *parent_name, *vco_name; + char clk_name[32], parent_name[32], vco_name[32]; struct clk_init_data vco_init = { .parent_data = &(const struct clk_parent_data) { .fw_name = "ref", @@ -404,18 +404,6 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov if (!bytediv) return -ENOMEM; - vco_name = devm_kzalloc(dev, 32, GFP_KERNEL); - if (!vco_name) - return -ENOMEM; - - parent_name = devm_kzalloc(dev, 32, GFP_KERNEL); - if (!parent_name) - return -ENOMEM; - - clk_name = devm_kzalloc(dev, 32, GFP_KERNEL); - if (!clk_name) - return -ENOMEM; - snprintf(vco_name, 32, "dsi%dvco_clk", pll_28nm->phy->id); vco_init.name = vco_name; -- 2.37.0
next prev parent reply other threads:[~2022-06-29 22:53 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-29 22:53 [PATCH v3 00/11] drm/msm/dsi_phy: Replace parent names with clk_hw pointers Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 01/11] clk: divider: Introduce devm_clk_hw_register_divider_parent_hw() Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-07-29 23:47 ` Stephen Boyd 2022-07-29 23:47 ` Stephen Boyd 2022-06-29 22:53 ` [PATCH v3 02/11] clk: mux: Introduce devm_clk_hw_register_mux_parent_hws() Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-07-29 23:47 ` Stephen Boyd 2022-07-29 23:47 ` Stephen Boyd 2022-06-29 22:53 ` [PATCH v3 03/11] clk: fixed-factor: Introduce *clk_hw_register_fixed_factor_parent_hw() Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-07-29 23:47 ` Stephen Boyd 2022-07-29 23:47 ` Stephen Boyd 2022-06-29 22:53 ` [PATCH v3 04/11] drm/msm/dsi/phy: Reindent and reflow multiline function calls Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten [this message] 2022-06-29 22:53 ` [PATCH v3 05/11] drm/msm/dsi_phy_28nm_8960: Use stack memory for temporary clock names Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 06/11] drm/msm/dsi/phy: Replace hardcoded char-array length with sizeof() Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 07/11] drm/msm/dsi_phy_28nm_8960: Replace parent names with clk_hw pointers Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 08/11] drm/msm/dsi_phy_28nm: " Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 09/11] drm/msm/dsi_phy_14nm: " Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 10/11] drm/msm/dsi_phy_10nm: " Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-06-29 22:53 ` [PATCH v3 11/11] drm/msm/dsi_phy_7nm: " Marijn Suijten 2022-06-29 22:53 ` Marijn Suijten 2022-07-14 10:19 ` [PATCH v3 00/11] drm/msm/dsi_phy: " Dmitry Baryshkov 2022-07-14 10:19 ` Dmitry Baryshkov 2022-07-29 23:41 ` Stephen Boyd 2022-07-29 23:41 ` Stephen Boyd
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220629225331.357308-6-marijn.suijten@somainline.org \ --to=marijn.suijten@somainline.org \ --cc=airlied@linux.ie \ --cc=angelogioacchino.delregno@somainline.org \ --cc=daniel@ffwll.ch \ --cc=dmitry.baryshkov@linaro.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=jami.kettunen@somainline.org \ --cc=jonathan@marek.ca \ --cc=konrad.dybcio@somainline.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=martin.botka@somainline.org \ --cc=mturquette@baylibre.com \ --cc=phone-devel@vger.kernel.org \ --cc=quic_abhinavk@quicinc.com \ --cc=quic_rajeevny@quicinc.com \ --cc=robdclark@gmail.com \ --cc=sboyd@kernel.org \ --cc=sean@poorly.run \ --cc=vladimir.lypak@gmail.com \ --cc=~postmarketos/upstreaming@lists.sr.ht \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.