linux/drivers/phy/qualcomm
Vladimir Zapolskiy bf7ffcd006 phy: qcom-qusb2: Fix a memory leak on probe
On success nvmem_cell_read() returns a pointer to a dynamically allocated
buffer, and therefore it shall be freed after usage.

The issue is reported by kmemleak:

  # cat /sys/kernel/debug/kmemleak
  unreferenced object 0xffff3b3803e4b280 (size 128):
    comm "kworker/u16:1", pid 107, jiffies 4294892861 (age 94.120s)
    hex dump (first 32 bytes):
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
      [<000000007739afdc>] __kmalloc+0x27c/0x41c
      [<0000000071c0fbf8>] nvmem_cell_read+0x40/0xe0
      [<00000000e803ef1f>] qusb2_phy_init+0x258/0x5bc
      [<00000000fc81fcfa>] phy_init+0x70/0x110
      [<00000000e3d48a57>] dwc3_core_soft_reset+0x4c/0x234
      [<0000000027d1dbd4>] dwc3_core_init+0x68/0x990
      [<000000001965faf9>] dwc3_probe+0x4f4/0x730
      [<000000002f7617ca>] platform_probe+0x74/0xf0
      [<00000000a2576cac>] really_probe+0xc4/0x470
      [<00000000bc77f2c5>] __driver_probe_device+0x11c/0x190
      [<00000000130db71f>] driver_probe_device+0x48/0x110
      [<0000000019f36c2b>] __device_attach_driver+0xa4/0x140
      [<00000000e5812ff7>]  bus_for_each_drv+0x84/0xe0
      [<00000000f4bac574>] __device_attach+0xe4/0x1c0
      [<00000000d3beb631>] device_initial_probe+0x20/0x30
      [<000000008019b9db>] bus_probe_device+0xa4/0xb0

Fixes: ca04d9d3e1 ("phy: qcom-qusb2: New driver for QUSB2 PHY on Qcom chips")
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210922233548.2150244-1-vladimir.zapolskiy@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2021-10-26 16:36:22 +05:30
..
Kconfig phy: qualcomm: Fix 28 nm Hi-Speed USB PHY OF dependency 2020-11-16 13:20:38 +05:30
Makefile phy: qualcomm: add qcom ipq806x dwc usb phy driver 2020-07-20 11:54:03 +05:30
phy-ath79-usb.c phy: ath79-usb: Fix the main reset name to match the DT binding 2019-01-16 18:00:57 +05:30
phy-qcom-apq8064-sata.c phy: qualcomm: convert to devm_platform_ioremap_resource(_byname) 2020-11-16 12:47:47 +05:30
phy-qcom-ipq806x-sata.c phy: qualcomm: convert to devm_platform_ioremap_resource(_byname) 2020-11-16 12:47:47 +05:30
phy-qcom-ipq806x-usb.c phy: qualcomm: remove duplicate argument 2021-03-25 12:55:40 +05:30
phy-qcom-ipq4019-usb.c phy: qualcomm: convert to devm_platform_ioremap_resource(_byname) 2020-11-16 12:47:47 +05:30
phy-qcom-pcie2.c phy: qualcomm: convert to devm_platform_ioremap_resource(_byname) 2020-11-16 12:47:47 +05:30
phy-qcom-qmp.c phy: qcom-qmp: Add QCM2290 USB3 PHY support 2021-10-26 16:36:22 +05:30
phy-qcom-qmp.h phy: qcom-qmp: Add QCM2290 USB3 PHY support 2021-10-26 16:36:22 +05:30
phy-qcom-qusb2.c phy: qcom-qusb2: Fix a memory leak on probe 2021-10-26 16:36:22 +05:30
phy-qcom-snps-femto-v2.c phy: qcom-snps: Add a set mode callback 2020-06-29 15:15:56 +05:30
phy-qcom-usb-hs-28nm.c phy: qualcomm: usb28nm: Add MDM9607 init sequence 2021-02-04 13:35:39 +05:30
phy-qcom-usb-hs.c phy: qualcomm: phy-qcom-usb-hs: repair non-kernel-doc comment 2021-08-06 17:15:29 +05:30
phy-qcom-usb-hsic.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
phy-qcom-usb-ss.c phy: qualcomm: usb: Add SuperSpeed PHY driver 2020-03-20 19:34:29 +05:30