Message ID | 20230615122051.546985-4-angelogioacchino.delregno@collabora.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | MediaTek clocks: various fixes | expand |
On Thu, Jun 15, 2023 at 8:21 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > In case of error after of_ioremap() the resource must be released: > call iounmap() where appropriate to fix that. > > Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe") > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Hi Angelo, On Thu, Jun 15, 2023 at 02:20:51PM +0200, AngeloGioacchino Del Regno wrote: > In case of error after of_ioremap() the resource must be released: > call iounmap() where appropriate to fix that. > > Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe") > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > --- > drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c > index ba1386e70a24..1bbb21ab1786 100644 > --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c > +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c > @@ -151,8 +151,10 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) > return -ENOMEM; > > clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); > - if (IS_ERR_OR_NULL(clk_data)) > + if (IS_ERR_OR_NULL(clk_data)) { > + iounmap(base); > return -ENOMEM; More of a nitpick, but I would prefer if you would use the same error catching style as the rest of the probe function: if (IS_ERR_OR_NULL(clk_data)) { r = -ENOMEM; goto unmap_io; } ... unmap_io: iounmap(base) return r; Best, Markus
Quoting AngeloGioacchino Del Regno (2023-06-15 05:20:51) > In case of error after of_ioremap() the resource must be released: > call iounmap() where appropriate to fix that. > > Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe") > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > --- Applied to clk-next
diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c index ba1386e70a24..1bbb21ab1786 100644 --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c @@ -151,8 +151,10 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) return -ENOMEM; clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); - if (IS_ERR_OR_NULL(clk_data)) + if (IS_ERR_OR_NULL(clk_data)) { + iounmap(base); return -ENOMEM; + } fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs)); r = mtk_clk_register_pllfhs(node, plls, ARRAY_SIZE(plls), @@ -186,6 +188,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev) ARRAY_SIZE(pllfhs), clk_data); free_clk_data: mtk_free_clk_data(clk_data); + iounmap(base); return r; }
In case of error after of_ioremap() the resource must be released: call iounmap() where appropriate to fix that. Fixes: 41138fbf876c ("clk: mediatek: mt8173: Migrate to platform driver and common probe") Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)