android_kernel_xiaomi_sm8350/drivers/clk
Brian Norris 8d1191f924 clk: fix leak on devm_clk_bulk_get_all() unwind
commit f828b0bcacef189edbd247e9f48864fc36bfbe33 upstream.

clk_bulk_get_all() allocates an array of struct clk_bulk data for us
(unlike clk_bulk_get()), so we need to free it. Let's use the
clk_bulk_put_all() helper.

kmemleak complains, on an RK3399 Gru/Kevin system:

unreferenced object 0xffffff80045def00 (size 128):
  comm "swapper/0", pid 1, jiffies 4294667682 (age 86.394s)
  hex dump (first 32 bytes):
    44 32 60 fe fe ff ff ff 00 00 00 00 00 00 00 00  D2`.............
    48 32 60 fe fe ff ff ff 00 00 00 00 00 00 00 00  H2`.............
  backtrace:
    [<00000000742860d6>] __kmalloc+0x22c/0x39c
    [<00000000b0493f2c>] clk_bulk_get_all+0x64/0x188
    [<00000000325f5900>] devm_clk_bulk_get_all+0x58/0xa8
    [<00000000175b9bc5>] dwc3_probe+0x8ac/0xb5c
    [<000000009169e2f9>] platform_drv_probe+0x9c/0xbc
    [<000000005c51e2ee>] really_probe+0x13c/0x378
    [<00000000c47b1f24>] driver_probe_device+0x84/0xc0
    [<00000000f870fcfb>] __device_attach_driver+0x94/0xb0
    [<000000004d1b92ae>] bus_for_each_drv+0x8c/0xd8
    [<00000000481d60c3>] __device_attach+0xc4/0x150
    [<00000000a163bd36>] device_initial_probe+0x1c/0x28
    [<00000000accb6bad>] bus_probe_device+0x3c/0x9c
    [<000000001a199f89>] device_add+0x218/0x3cc
    [<000000001bd84952>] of_device_add+0x40/0x50
    [<000000009c658c29>] of_platform_device_create_pdata+0xac/0x100
    [<0000000021c69ba4>] of_platform_bus_create+0x190/0x224

Fixes: f08c2e2865 ("clk: add managed version of clk_bulk_get_all")
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: stable@vger.kernel.org
Signed-off-by: Brian Norris <briannorris@chromium.org>
Link: https://lore.kernel.org/r/20210731025950.2238582-1-briannorris@chromium.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-12 13:21:00 +02:00
..
actions clk: actions: Fix bisp_factor_table based clocks on Owl S500 SoC 2021-07-14 16:53:34 +02:00
analogbits
at91 clk: at91: sam9x60: remove atmel,osc-bypass support 2020-12-30 11:51:29 +01:00
axis
axs10x
bcm clk: bcm2835: add missing release if devm_clk_hw_register fails 2020-10-29 09:57:55 +01:00
berlin
davinci
h8300
hisilicon
imgtec
imx clk: imx8mq: Fix usdhc parents order 2020-10-29 09:57:56 +01:00
ingenic clk: ingenic: Fix divider calculation with div tables 2020-12-30 11:51:45 +01:00
keystone clk: keystone: sci-clk: fix parsing assigned-clock data during probe 2020-10-29 09:57:54 +01:00
loongson1
mediatek clk: mediatek: add UART0 clock support 2020-10-29 09:57:54 +01:00
meson clk: meson: g12a: fix gp0 and hifi ranges 2021-07-14 16:53:26 +02:00
microchip
mmp
mvebu clk: mvebu: armada-37xx-periph: Fix workaround for switching from L1 to L0 2021-05-14 09:44:21 +02:00
mxs
nxp
pistachio
pxa
qcom clk: qcom: a53-pll: Add missing MODULE_DEVICE_TABLE 2021-05-14 09:44:25 +02:00
renesas clk: renesas: r8a77995: Add ZA2 clock 2021-07-19 08:53:09 +02:00
rockchip clk: rockchip: Initialize hw to error to avoid undefined behavior 2020-10-29 09:57:54 +01:00
samsung clk: exynos7: Mark aclk_fsys1_200 as critical 2021-05-19 10:08:33 +02:00
sifive
sirf
socfpga clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return 2021-05-11 14:04:10 +02:00
spear
sprd
st
sunxi
sunxi-ng clk: sunxi-ng: h6: Fix clock divider range on some clocks 2021-03-04 10:26:29 +01:00
tegra clk: tegra: Ensure that PLLU configuration is applied properly 2021-07-19 08:53:09 +02:00
ti clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940 2021-06-23 14:41:31 +02:00
uniphier clk: uniphier: Fix potential infinite loop 2021-05-14 09:44:25 +02:00
ux500
versatile
x86
zte
zynq
zynqmp clk: zynqmp: move zynqmp_pll_set_mode out of round_rate callback 2021-05-14 09:44:24 +02:00
clk-asm9260.c
clk-aspeed.c
clk-aspeed.h
clk-ast2600.c media: aspeed: fix clock handling logic 2021-05-14 09:44:23 +02:00
clk-axi-clkgen.c
clk-axm5516.c
clk-bd718x7.c
clk-bulk.c
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c
clk-composite.c
clk-conf.c
clk-cs2000-cp.c
clk-devres.c clk: fix leak on devm_clk_bulk_get_all() unwind 2021-08-12 13:21:00 +02:00
clk-divider.c
clk-efm32gg.c
clk-fixed-factor.c
clk-fixed-mmio.c
clk-fixed-rate.c
clk-fractional-divider.c
clk-gate.c
clk-gemini.c
clk-gpio.c
clk-hi655x.c
clk-highbank.c
clk-hsdk-pll.c
clk-lochnagar.c
clk-max9485.c
clk-max77686.c
clk-milbeaut.c
clk-moxart.c
clk-multiplier.c
clk-mux.c
clk-nomadik.c
clk-npcm7xx.c
clk-nspire.c
clk-oxnas.c
clk-palmas.c
clk-pwm.c
clk-qoriq.c
clk-rk808.c
clk-s2mps11.c clk: s2mps11: Fix a resource leak in error handling paths in the probe function 2020-12-30 11:51:29 +01:00
clk-scmi.c
clk-scpi.c
clk-si514.c
clk-si544.c
clk-si570.c
clk-si5341.c clk: si5341: Update initialization magic 2021-07-14 16:53:35 +02:00
clk-si5351.c
clk-si5351.h
clk-stm32f4.c clk: stm32f4: fix post divisor setup for I2S/SAI PLLs 2021-08-12 13:20:55 +02:00
clk-stm32h7.c
clk-stm32mp1.c
clk-tango4.c
clk-twl6040.c
clk-u300.c
clk-versaclock5.c
clk-vt8500.c
clk-wm831x.c
clk-xgene.c
clk.c clk: fix invalid usage of list cursor in unregister 2021-04-14 08:24:17 +02:00
clk.h
clkdev.c
Kconfig
Makefile