linux/drivers/clk/microchip
Geert Uytterhoeven 86d884f528 clk: microchip: mpfs-ccc: Use devm_kasprintf() for allocating formatted strings
In various places, string buffers of a fixed size are allocated, and
filled using snprintf() with the same fixed size, which is error-prone.

Replace this by calling devm_kasprintf() instead, which always uses the
appropriate size.

While at it, remove an unneeded intermediate variable, which allows us
to drop a cast as a bonus.

With the initial behavior it would have been possible to have a device tree
with a node address that would make "ccc<node_address>_pll<N>" exceed
18 characters. If that happened, the <N> would be cut off & both
pll 0 & 1 would be named identically. If that happens, pll1 would fail
to register. Thus, the fixes tag has been added to this commit.

Fixes: d39fb17276 ("clk: microchip: add PolarFire SoC fabric clock support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
[claudiu.beznea: added the rationale behind fixes tag]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/f904fd28b2087d1463ea65f059924e3b1acc193c.1672764239.git.geert+renesas@glider.be
2023-01-19 11:45:35 +02:00
..
clk-core.c clk: let init callback return an error code 2019-12-23 18:53:13 -08:00
clk-core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445 2019-06-05 17:37:18 +02:00
clk-mpfs-ccc.c clk: microchip: mpfs-ccc: Use devm_kasprintf() for allocating formatted strings 2023-01-19 11:45:35 +02:00
clk-mpfs.c clk: microchip: mpfs: update module authorship & licencing 2022-09-14 10:57:07 +03:00
clk-pic32mzda.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445 2019-06-05 17:37:18 +02:00
Kconfig clk: microchip: enable the MPFS clk driver by default if SOC_MICROCHIP_POLARFIRE 2022-12-08 17:12:08 -08:00
Makefile clk: microchip: add PolarFire SoC fabric clock support 2022-09-14 10:57:07 +03:00