* [bug report] clk: imx: add i.MX93 clk
@ 2022-10-21 13:29 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-10-21 13:29 UTC (permalink / raw)
To: peng.fan; +Cc: linux-clk
Hello Peng Fan,
The patch 24defbe194b6: "clk: imx: add i.MX93 clk" from Feb 28, 2022,
leads to the following Smatch static checker warning:
drivers/clk/imx/clk-imx93.c:331 imx93_clocks_probe()
warn: 'base' from of_iomap() not released on lines: 301,331.
drivers/clk/imx/clk-imx93.c
255 static int imx93_clocks_probe(struct platform_device *pdev)
256 {
257 struct device *dev = &pdev->dev;
258 struct device_node *np = dev->of_node;
259 const struct imx93_clk_root *root;
260 const struct imx93_clk_ccgr *ccgr;
261 void __iomem *base = NULL;
262 int i, ret;
263
264 clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
265 IMX93_CLK_END), GFP_KERNEL);
266 if (!clk_hw_data)
267 return -ENOMEM;
268
269 clk_hw_data->num = IMX93_CLK_END;
270 clks = clk_hw_data->hws;
271
272 clks[IMX93_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0);
273 clks[IMX93_CLK_24M] = imx_obtain_fixed_clk_hw(np, "osc_24m");
274 clks[IMX93_CLK_32K] = imx_obtain_fixed_clk_hw(np, "osc_32k");
275 clks[IMX93_CLK_EXT1] = imx_obtain_fixed_clk_hw(np, "clk_ext1");
276
277 clks[IMX93_CLK_SYS_PLL_PFD0] = imx_clk_hw_fixed("sys_pll_pfd0", 1000000000);
278 clks[IMX93_CLK_SYS_PLL_PFD0_DIV2] = imx_clk_hw_fixed_factor("sys_pll_pfd0_div2",
279 "sys_pll_pfd0", 1, 2);
280 clks[IMX93_CLK_SYS_PLL_PFD1] = imx_clk_hw_fixed("sys_pll_pfd1", 800000000);
281 clks[IMX93_CLK_SYS_PLL_PFD1_DIV2] = imx_clk_hw_fixed_factor("sys_pll_pfd1_div2",
282 "sys_pll_pfd1", 1, 2);
283 clks[IMX93_CLK_SYS_PLL_PFD2] = imx_clk_hw_fixed("sys_pll_pfd2", 625000000);
284 clks[IMX93_CLK_SYS_PLL_PFD2_DIV2] = imx_clk_hw_fixed_factor("sys_pll_pfd2_div2",
285 "sys_pll_pfd2", 1, 2);
286
287 np = of_find_compatible_node(NULL, NULL, "fsl,imx93-anatop");
288 base = of_iomap(np, 0);
^^^^^^^^^^^^^^^^^^^^^^^
Smatch thinks that this iomap() needs to be unmaped on error paths.
289 of_node_put(np);
290 if (WARN_ON(!base))
291 return -ENOMEM;
292
293 clks[IMX93_CLK_AUDIO_PLL] = imx_clk_fracn_gppll("audio_pll", "osc_24m", base + 0x1200,
294 &imx_fracn_gppll);
295 clks[IMX93_CLK_VIDEO_PLL] = imx_clk_fracn_gppll("video_pll", "osc_24m", base + 0x1400,
296 &imx_fracn_gppll);
297
298 np = dev->of_node;
299 base = devm_platform_ioremap_resource(pdev, 0);
^^^^^^^^
"base" is re-assigned here. Smatch is correct, no?
300 if (WARN_ON(IS_ERR(base)))
301 return PTR_ERR(base);
302
303 for (i = 0; i < ARRAY_SIZE(root_array); i++) {
304 root = &root_array[i];
305 clks[root->clk] = imx93_clk_composite_flags(root->name,
306 parent_names[root->sel],
307 4, base + root->off, 3,
308 root->flags);
309 }
310
311 for (i = 0; i < ARRAY_SIZE(ccgr_array); i++) {
312 ccgr = &ccgr_array[i];
313 clks[ccgr->clk] = imx93_clk_gate(NULL, ccgr->name, ccgr->parent_name,
314 ccgr->flags, base + ccgr->off, 0, 1, 1, 3,
315 ccgr->shared_count);
316 }
317
318 imx_check_clk_hws(clks, IMX93_CLK_END);
319
320 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
321 if (ret < 0) {
322 dev_err(dev, "failed to register clks for i.MX93\n");
323 goto unregister_hws;
324 }
325
326 return 0;
327
328 unregister_hws:
329 imx_unregister_hw_clocks(clks, IMX93_CLK_END);
330
--> 331 return ret;
332 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-21 13:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-21 13:29 [bug report] clk: imx: add i.MX93 clk Dan Carpenter
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.