linux-stable/drivers/regulator
YAN SHI ad6481f49f regulator: stm32-pwr: fix of_iomap leak
[ Upstream commit c4a413e56d ]

Smatch reports:
drivers/regulator/stm32-pwr.c:166 stm32_pwr_regulator_probe() warn:
'base' from of_iomap() not released on lines: 151,166.

In stm32_pwr_regulator_probe(), base is not released
when devm_kzalloc() fails to allocate memory or
devm_regulator_register() fails to register a new regulator device,
which may cause a leak.

To fix this issue, replace of_iomap() with
devm_platform_ioremap_resource(). devm_platform_ioremap_resource()
is a specialized function for platform devices.
It allows 'base' to be automatically released whether the probe
function succeeds or fails.

Besides, use IS_ERR(base) instead of !base
as the return value of devm_platform_ioremap_resource()
can either be a pointer to the remapped memory or
an ERR_PTR() encoded error code if the operation fails.

Fixes: dc62f951a6 ("regulator: stm32-pwr: Fix return value check in stm32_pwr_regulator_probe()")
Signed-off-by: YAN SHI <m202071378@hust.edu.cn>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304111750.o2643eJN-lkp@intel.com/
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/r/20230412033529.18890-1-m202071378@hust.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:00:24 +09:00
..
88pg86x.c regulator: 88pg86x: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:09 +01:00
88pm800-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
88pm8607.c
aat2870-regulator.c
ab8500-ext.c regulator: ab8500: Decomission platform data header 2021-01-13 11:36:19 +00:00
ab8500.c regulator: ab8500: Decomission platform data header 2021-01-13 11:36:19 +00:00
act8865-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
act8945a-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
ad5398.c
anatop-regulator.c regulator: anatop: Constify anatop_core_rops 2020-06-18 13:47:31 +01:00
arizona-ldo1.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
arizona-micsupp.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
as3711-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
as3722-regulator.c regulator: as3722: Fix fall-through warnings for Clang 2020-11-23 18:46:31 +00:00
atc260x-regulator.c regulator: atc260x: Fix missing active_discharge_on setting 2022-04-13 20:59:17 +02:00
axp20x-regulator.c regulator: axp20x: Fix reference cout leak 2021-01-20 18:48:20 +00:00
bcm590xx-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
bd718x7-regulator.c regulator: bd718x7: Suopport configuring UVP/OVP state 2021-07-11 23:50:44 +01:00
bd9571mwv-regulator.c regulator: bd9571mwv: Convert device attribute to sysfs_emit() 2021-03-15 15:42:12 +00:00
bd9576-regulator.c regulator: bd9576: Fix testing wrong flag in check_temp_flag_mismatch 2021-07-01 14:50:30 +01:00
bd71815-regulator.c regulator: bd71815: Get rid of struct bd71815_pmic 2021-06-08 13:37:46 +01:00
bd71828-regulator.c regulator: bd718x7, bd71828: Use ramp-delay helper 2021-04-14 10:19:59 +01:00
core.c regulator: core: Avoid lockdep reports when resolving supplies 2023-05-11 23:00:23 +09:00
cpcap-regulator.c regulator: cpcap-regulator: Demote kerneldoc header to standard comment 2020-06-25 20:11:16 +01:00
cros-ec-regulator.c regulator: cros-ec: Fix error code in dev_err message 2021-05-12 13:01:41 +01:00
da903x-regulator.c regulator: rename da903x to da903x-regulator 2020-06-25 15:29:21 +01:00
da9052-regulator.c regulator: da9052: Ensure enough delay time for .set_voltage_time_sel 2021-06-23 12:34:40 +01:00
da9055-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
da9062-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
da9063-regulator.c regulator: da9063: Add support for full-current mode. 2021-07-15 17:24:50 +01:00
da9121-regulator.c regulator: da9121: Fix uninit-value in da9121_assign_chip_model() 2022-06-09 10:22:48 +02:00
da9121-regulator.h regulator: da9121: automotive variants identity fix 2021-04-21 15:49:51 +01:00
da9210-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
da9210-regulator.h
da9211-regulator.c regulator: da9211: Use irq handler when ready 2023-01-18 11:48:53 +01:00
da9211-regulator.h
db8500-prcmu.c regulator: db8500-prcmu: Use true,false for bool variable 2020-05-06 15:16:59 +01:00
dbx500-prcmu.c regulator: Replace symbolic permissions with octal permissions 2021-07-11 23:50:43 +01:00
dbx500-prcmu.h
devres.c regulator: devres: unexport devm_regulator_unregister_supply_alias() 2021-07-11 23:50:34 +01:00
dummy.c regulator: dummy: Constify dummy_initdata and dummy_ops 2020-09-14 14:24:36 +01:00
dummy.h
fan53555.c regulator: fan53555: Fix wrong TCS_SLEW_MASK 2023-04-26 13:51:47 +02:00
fan53880.c Merge remote-tracking branch 'regulator/for-5.14' into regulator-next 2021-06-23 16:56:31 +01:00
fixed-helper.c
fixed.c regulator: Handle deferred clk 2023-04-05 11:24:55 +02:00
gpio-regulator.c regulator: gpio: Honor regulator-boot-on property 2020-07-20 16:31:54 +01:00
helpers.c regulator: Check ramp_delay_table for regulator_set_ramp_delay_regmap 2021-05-19 14:31:43 +01:00
hi655x-regulator.c regulator: hi655x: Fix pass wrong pointer to config.driver_data 2021-06-21 13:02:05 +01:00
hi6421-regulator.c regulator: hi6421: Fix getting wrong drvdata 2021-07-11 23:44:37 +01:00
hi6421v530-regulator.c regulator: Replace HTTP links with HTTPS ones 2020-07-22 14:43:48 +01:00
hi6421v600-regulator.c regulator: hi6421v600: rename voltage range arrays 2021-07-26 02:16:49 +01:00
internal.h regulator: move rdev_print helpers to internal.h 2021-06-21 13:08:39 +01:00
irq_helpers.c regulator: Documentation fix for regulator error notification helper 2021-08-23 11:06:28 +01:00
isl6271a-regulator.c
isl9305.c
Kconfig regulator: rtq2134: Add support for Richtek RTQ2134 SubPMIC 2021-07-20 13:37:29 +01:00
lm363x-regulator.c
lochnagar-regulator.c regulator: lochnagar: Add additional VDDCORE range 2020-09-07 18:49:13 +01:00
lp872x.c regulator: lp872x: make a const array static, makes object smaller 2020-10-26 20:56:58 +00:00
lp873x-regulator.c regulator: Replace HTTP links with HTTPS ones 2020-07-22 14:43:48 +01:00
lp3971.c
lp3972.c
lp8755.c regulator: lp8755: Convert to use regulator_set_ramp_delay_regmap 2021-06-01 14:05:23 +01:00
lp8788-buck.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
lp8788-ldo.c
lp87565-regulator.c mfd: lp87565: Move LP87565_regulator_id to .c file 2021-05-19 13:34:00 +01:00
ltc3589.c regulator: ltc3589: Convert to use regulator_set_ramp_delay_regmap 2021-06-08 13:37:45 +01:00
ltc3676.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
Makefile regulator: rtq2134: Add support for Richtek RTQ2134 SubPMIC 2021-07-20 13:37:29 +01:00
max1586.c regulator: max1586: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:14 +01:00
max8649.c
max8660.c
max8893.c regulator: max8893: add regulator driver 2021-06-21 13:07:44 +01:00
max8907-regulator.c regulator: max8907: Constify static structs 2020-06-18 13:47:34 +01:00
max8925-regulator.c
max8952.c
max8973-regulator.c regulator: max8973: Convert to use regulator_set_ramp_delay_regmap 2021-05-24 09:51:34 +01:00
max8997-regulator.c regulator: max8997: Constify struct regulator_ops 2020-06-18 13:47:35 +01:00
max8998.c regulator: max8998: Staticify internal function max8998_get_current_limit() 2020-06-26 15:34:18 +01:00
max14577-regulator.c regulator: max14577: Revert "regulator: max14577: Add proper module aliases strings" 2021-09-17 13:16:38 +01:00
max77620-regulator.c regulator: max77620: Silence deferred probe error 2021-05-24 09:50:20 +01:00
max77650-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
max77686-regulator.c regulator: max77686: Convert to use regulator_set_ramp_delay_regmap 2021-06-07 16:24:07 +01:00
max77693-regulator.c
max77802-regulator.c regulator: max77802: Bounds check regulator id against opmode 2023-03-10 09:39:53 +01:00
max77826-regulator.c regulator: max77826: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:15 +01:00
mc13xxx-regulator-core.c
mc13xxx.h
mc13783-regulator.c
mc13892-regulator.c regulator: mc13892-regulator: convert comma to semicolon 2020-12-11 13:23:07 +00:00
mcp16502.c regulator: mcp16502: Convert to use regulator_set_ramp_delay_regmap 2021-06-01 14:05:26 +01:00
mp886x.c regulator: mp886x: Convert to use regulator_set_ramp_delay_regmap 2021-05-25 16:45:09 +01:00
mp5416.c regulator: mp5416: Convert to use regulator_set_ramp_delay_regmap 2021-05-25 16:45:10 +01:00
mp8859.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mpq7920.c
mpq7920.h
mt6311-regulator.c
mt6311-regulator.h
mt6315-regulator.c Merge remote-tracking branch 'regulator/for-5.14' into regulator-next 2021-06-23 16:56:31 +01:00
mt6323-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mt6358-regulator.c regulator: mt6358: Remove shift fields from struct mt6358_regulator_info 2021-07-11 23:50:35 +01:00
mt6359-regulator.c regulator: mt6359: Remove shift fields from struct mt6359_regulator_info 2021-07-11 23:50:36 +01:00
mt6360-regulator.c regulator: mt6360: remove redundant error print 2021-03-24 19:50:21 +00:00
mt6380-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mt6397-regulator.c regulator: mt6397: Remove modeset_shift from struct mt6397_regulator_info 2021-07-11 23:50:37 +01:00
mtk-dvfsrc-regulator.c regulator: mtk-dvfsrc: Fix wrong dev pointer for devm_regulator_register 2021-07-07 12:01:32 +01:00
of_regulator.c regulator: of: Fix refcount leak bug in of_get_regulation_constraints() 2022-08-17 14:23:14 +02:00
palmas-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
pbias-regulator.c regulator: Replace HTTP links with HTTPS ones 2020-07-22 14:43:48 +01:00
pca9450-regulator.c regulator: pca9450: Convert to use regulator_set_ramp_delay_regmap 2021-06-01 14:05:21 +01:00
pcap-regulator.c
pcf50633-regulator.c
pf8x00-regulator.c regulator: pf8x00: Use regulator_map_voltage_ascend for pf8x00_buck7_ops 2021-03-10 12:47:46 +00:00
pfuze100-regulator.c regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe() 2022-09-23 14:15:50 +02:00
pv88060-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
pv88060-regulator.h
pv88080-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
pv88080-regulator.h
pv88090-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
pv88090-regulator.h
pwm-regulator.c Merge remote-tracking branch 'regulator/for-5.10' into regulator-next 2020-10-05 16:54:56 +01:00
qcom-labibb-regulator.c regulator: qcom-labibb: Fix missing of_node_put() in qcom_labibb_regulator_probe() 2022-12-31 13:14:17 +01:00
qcom-rpmh-regulator.c regulator: qcom-rpmh: Fix PMR735a S3 regulator spec 2022-12-31 13:14:10 +01:00
qcom_rpm-regulator.c regulator: qcom_rpm: Fix circular deferral regression 2022-10-26 12:34:21 +02:00
qcom_smd-regulator.c regulator: qcom_smd: Fix pm8916_pldo range 2022-08-17 14:23:09 +02:00
qcom_spmi-regulator.c regulator: add property parsing and callbacks to set protection limits 2021-06-21 13:08:41 +01:00
qcom_usb_vbus-regulator.c regulator: Add a routine to set the current limit for QCOM PMIC VBUS 2021-05-10 13:06:50 +01:00
rc5t583-regulator.c
rk808-regulator.c regulator: rk808: Convert to use regulator_set_ramp_delay_regmap 2021-05-26 19:22:09 +01:00
rn5t618-regulator.c
rohm-regulator.c regulator: rohm-regulator: Support SNVS HW state. 2021-04-14 10:19:48 +01:00
rpi-panel-attiny-regulator.c regulator: rpi-panel: Handle I2C errors/timing to the Atmel 2022-04-08 14:23:54 +02:00
rt4801-regulator.c regulator: rt4801: Fix NULL pointer dereference if priv->enable_gpios is NULL 2021-06-03 19:35:48 +01:00
rt4831-regulator.c regulator: rt4831: Add missing .owner field in regulator_desc 2021-05-25 16:45:11 +01:00
rt5033-regulator.c regulator: rt5033: Use linear ranges to map all voltage selection 2021-07-11 23:50:39 +01:00
rt6160-regulator.c regulator: rt6160: Fix setting suspend voltage 2021-06-16 15:41:16 +01:00
rt6245-regulator.c regulator: rt6245: make a const array func_base static, makes object smaller 2021-07-15 17:24:49 +01:00
rtmv20-regulator.c Merge existing fixes from regulator/for-5.14 2021-07-11 23:45:15 +01:00
rtq2134-regulator.c regulator: rtq2134: Fix missing active_discharge_on setting 2022-04-13 20:59:16 +02:00
rtq6752-regulator.c regulator: rtq6752: fix reg reset behavior 2021-07-16 13:55:34 +01:00
s2mpa01.c regulator: s2mpa01: Drop initialization via platform data 2021-04-21 15:51:42 +01:00
s2mps11.c regulator: s2mps11: Drop initialization via platform data 2021-04-21 15:51:43 +01:00
s5m8767.c regulator: s5m8767: Bounds check id indexing into arrays 2023-03-10 09:39:53 +01:00
sc2731-regulator.c
scmi-regulator.c regulator: scmi: Fix refcount leak in scmi_regulator_probe 2022-06-09 10:23:00 +02:00
sky81452-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
slg51000-regulator.c regulator: slg51000: Wait after asserting CS pin 2022-12-14 11:37:16 +01:00
slg51000-regulator.h
stm32-booster.c regulator: stm32-booster: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:20 +01:00
stm32-pwr.c regulator: stm32-pwr: fix of_iomap leak 2023-05-11 23:00:24 +09:00
stm32-vrefbuf.c regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:18 +01:00
stpmic1_regulator.c regulator: add property parsing and callbacks to set protection limits 2021-06-21 13:08:41 +01:00
stw481x-vmmc.c regulator: stw481x-vmmc: Constify static structs 2020-09-14 14:24:38 +01:00
sy7636a-regulator.c regulator: sy7636a: Use the regmap directly 2021-08-09 12:40:26 +01:00
sy8106a-regulator.c regulator: sy8106a: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:19 +01:00
sy8824x.c regulator: sy8824x: Enable REGCACHE_FLAT 2021-08-03 18:27:18 +01:00
sy8827n.c regulator: sy8827n: Enable REGCACHE_FLAT 2021-08-03 18:27:19 +01:00
ti-abb-regulator.c regulator: ti-abb: Fix array out of bound read access on the first transition 2020-11-18 17:59:24 +00:00
tps6105x-regulator.c regulator: tps6105x: Constify tps6105x_regulator_ops 2020-09-01 15:48:52 +01:00
tps6507x-regulator.c regulator: Replace HTTP links with HTTPS ones 2020-07-22 14:43:48 +01:00
tps6524x-regulator.c
tps6586x-regulator.c regulator: tps6586x: Constify static regulator_ops 2020-09-01 15:48:56 +01:00
tps51632-regulator.c regulator: tps51632: Constify tps51632_dcdc_ops 2020-09-01 15:48:51 +01:00
tps62360-regulator.c regulator: tps62360: Constify tps62360_dcdc_ops 2020-09-01 15:48:53 +01:00
tps65023-regulator.c regulator: tps65023: Fix W=1 build warning when CONFIG_OF=n 2020-08-21 17:28:21 +01:00
tps65086-regulator.c regulator: tps65086: Constify static regulator_ops 2020-09-01 15:48:54 +01:00
tps65090-regulator.c regulator: tps65090: constify static regulator_ops 2020-09-01 15:48:55 +01:00
tps65132-regulator.c
tps65217-regulator.c regulator: Replace HTTP links with HTTPS ones 2020-07-22 14:43:48 +01:00
tps65218-regulator.c regulator: Replace HTTP links with HTTPS ones 2020-07-22 14:43:48 +01:00
tps65910-regulator.c regulator: tps65910: Silence deferred probe error 2021-07-11 23:50:38 +01:00
tps65912-regulator.c regulator: tps65912: Constify static regulator_ops 2020-09-01 15:48:56 +01:00
tps80031-regulator.c regulator: tps80031: remove redundant assignment to variables ret and val 2020-04-14 16:57:44 +01:00
twl-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
twl6030-regulator.c regulator: twl6030: fix get status of twl6032 regulators 2022-12-14 11:37:16 +01:00
uniphier-regulator.c regulator: uniphier: Add missing MODULE_DEVICE_TABLE 2021-05-11 10:05:48 +01:00
userspace-consumer.c regulator: userspace-consumer: use DEVICE_ATTR_RO/RW macro 2021-06-02 12:03:37 +01:00
vctrl-regulator.c regulator: vctrl: Avoid lockdep warning in enable/disable ops 2021-08-25 14:17:53 +01:00
vexpress-regulator.c
virtual.c
vqmmc-ipq4019-regulator.c
wm831x-dcdc.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
wm831x-isink.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
wm831x-ldo.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
wm8350-regulator.c regulator: remove locking around regulator_notifier_call_chain() 2020-09-07 18:35:25 +01:00
wm8400-regulator.c regulator: wm8400-regulator: Repair dodgy kerneldoc header formatting 2020-06-26 15:34:24 +01:00
wm8994-regulator.c regulator: wm8994: Add an off-on delay for WM8994 variant 2022-04-20 09:34:16 +02:00