linux/drivers/pcmcia
Yang Yingliang c3e148aba9 pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
[ Upstream commit 99e1241049 ]

Afer commit 1fa5ae857b ("driver core: get rid of struct device's
bus_id string array"), the name of device is allocated dynamically.
Therefore, it needs to be freed, which is done by the driver core for
us once all references to the device are gone. Therefore, move the
dev_set_name() call immediately before the call device_register(), which
either succeeds (then the freeing will be done upon subsequent remvoal),
or puts the reference in the error call. Also, it is not unusual that the
return value of dev_set_name is not checked.

Fixes: 1fa5ae857b ("driver core: get rid of struct device's bus_id string array")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
[linux@dominikbrodowski.net: simplification, commit message modified]
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:06:54 +01:00
..
at91_cf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
bcm63xx_pcmcia.c drivers/pcmcia: Convert timers to use timer_setup() 2017-11-04 12:03:13 +01:00
bcm63xx_pcmcia.h
cardbus.c pcmcia: include cs_internal.h for missing declarations 2019-11-22 07:03:04 +01:00
cirrus.h
cistpl.c pcmcia: include <pcmcia/ds.h> for pcmcia_parse_tuple 2019-11-22 07:03:04 +01:00
cs_internal.h pcmcia: make pccard_loop_tuple() static 2020-05-18 11:16:39 +02:00
cs.c pcmcia: cs: fix possible hung task and memory leak pccardd() 2023-11-20 11:06:54 +01:00
db1xxx_ss.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ds.c pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:06:54 +01:00
electra_cf.c powerpc: add an ioremap_phb helper 2020-06-02 10:59:10 -07:00
i82092.c pcmcia: i82092: fix a null pointer dereference bug 2021-08-12 13:22:16 +02:00
i82092aa.h PCMCIA/i82092: delete enter/leave macro 2019-12-16 11:49:54 +01:00
i82365.c drivers/pcmcia: Convert timers to use timer_setup() 2017-11-04 12:03:13 +01:00
i82365.h
Kconfig pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards 2022-06-14 18:32:30 +02:00
Makefile pcmcia: add MAX1600 library 2018-12-04 22:37:38 +00:00
max1600.c pcmcia: add MAX1600 library 2018-12-04 22:37:38 +00:00
max1600.h pcmcia: add MAX1600 library 2018-12-04 22:37:38 +00:00
o2micro.h
omap_cf.c pcmcia: omap: remove useless cast for driver.name 2020-03-14 14:32:02 +01:00
pcmcia_cis.c pcmcia: make pccard_loop_tuple() static 2020-05-18 11:16:39 +02:00
pcmcia_resource.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pd6729.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
pd6729.h
pxa2xx_balloon3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_base.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 256 2019-06-05 17:30:27 +02:00
pxa2xx_base.h
pxa2xx_cm_x2xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_cm_x255.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_cm_x270.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_colibri.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_e740.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_hx4700.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_mainstone.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_palmld.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_palmtc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_palmtx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_sharpsl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_stargate2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_trizeps4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_viper.c
pxa2xx_vpac270.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ricoh.h pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges 2018-10-01 12:17:03 +02:00
rsrc_iodyn.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rsrc_mgr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rsrc_nonstatic.c pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db() 2023-08-26 15:26:45 +02:00
sa11xx_base.c
sa11xx_base.h
sa1100_generic.c ARM: sa1100/shannon: convert to generic CF sockets 2018-04-06 15:53:22 +01:00
sa1100_generic.h ARM: sa1100/shannon: convert to generic CF sockets 2018-04-06 15:53:22 +01:00
sa1100_h3600.c ARM: sa1100/h3xxx: switch h3xxx PCMCIA to use gpiod APIs 2018-03-24 14:17:09 +00:00
sa1100_simpad.c pcmcia: remove some unused space characters 2020-03-31 18:48:22 +02:00
sa1111_badge4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sa1111_generic.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
sa1111_generic.h
sa1111_jornada720.c ARM: sa1100/jornada720: switch PCMCIA to gpiod APIs 2018-12-04 22:37:38 +00:00
sa1111_lubbock.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sa1111_neponset.c ARM: sa1100/neponset: switch PCMCIA to MAX1600 library and gpiod APIs 2018-12-04 22:37:38 +00:00
soc_common.c gpiolib: Pass array info to get/set array functions 2018-09-13 11:16:54 +02:00
soc_common.h pcmcia: soc_common.h: Replace zero-length array with flexible-array member 2020-03-28 07:52:13 +01:00
socket_sysfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tcic.c drivers/pcmcia: Convert timers to use timer_setup() 2017-11-04 12:03:13 +01:00
tcic.h
ti113x.h
topic.h
vg468.h
vrc4171_card.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
vrc4173_cardu.c
vrc4173_cardu.h
xxs1500_ss.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
yenta_socket.c pcmcia: Use CardBus window names (PCI_CB_BRIDGE_IO_0_WINDOW etc) when freeing 2020-05-21 15:53:07 -05:00
yenta_socket.h