linux-stable/drivers/base
Dan Carpenter d3b6b252ba node: fix device cleanups in error handling code
[ Upstream commit 4ce535ec00 ]

We can't use kfree() to free device managed resources so the kfree(dev)
is against the rules.

It's easier to write this code if we open code the device_register() as
a device_initialize() and device_add().  That way if dev_set_name() set
name fails we can call put_device() and it will clean up correctly.

Fixes: acc02a109b ("node: Add memory-side caching attributes")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YHA0JUra+F64+NpB@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-14 09:44:22 +02:00
..
firmware_loader firmware_loader: fix memory leak for paged buffer 2020-09-23 12:40:34 +02:00
power PM: runtime: Fix ordering in pm_runtime_get_suppliers() 2021-04-07 14:47:42 +02:00
regmap regmap: set debugfs_name to NULL after it is freed 2021-05-14 09:44:17 +02:00
test driver core: Fix test_async_driver_probe if NUMA is disabled 2020-02-01 09:34:36 +00:00
arch_topology.c cpu-topology: Fix the potential data corruption 2020-10-01 13:17:40 +02:00
attribute_container.c
base.h driver/core: Convert to use built-in RCU list checking 2019-08-13 14:28:47 -07:00
bus.c drivers: Introduce device lookup variants by name 2019-07-30 13:07:41 +02:00
cacheinfo.c Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00
class.c
component.c component: Silence bind error on -EPROBE_DEFER 2020-05-27 17:46:31 +02:00
container.c
core.c driver core: Extend device_is_dependent() 2021-01-27 11:47:51 +01:00
cpu.c x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation 2020-06-10 20:24:57 +02:00
dd.c driver core: Fix locking bug in deferred_probe_timeout_work_func() 2021-04-16 11:46:38 +02:00
devcon.c Merge generic_lookup_helpers into usb-next 2019-09-03 17:11:07 +02:00
devcoredump.c devcoredump: fix typo in comment 2019-08-15 17:38:11 +02:00
devres.c drivers/base/devres: introduce devm_release_action() 2019-06-13 17:34:56 -10:00
devtmpfs.c vfs: Convert ramfs, shmem, tmpfs, devtmpfs, rootfs to use the new mount API 2019-09-12 21:05:34 -04:00
driver.c driver_find_device: Unify the match function with class_find_device() 2019-06-24 05:22:31 +02:00
firmware.c
hypervisor.c
init.c
isa.c
Kconfig base: arch_topology: update Kconfig help description 2019-07-22 09:36:44 -07:00
Makefile
map.c
memory.c drivers/base/memory.c: indicate all memory blocks as removable 2020-04-01 11:02:02 +02:00
module.c
node.c node: fix device cleanups in error handling code 2021-05-14 09:44:22 +02:00
pinctrl.c
platform-msi.c
platform.c drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish 2020-06-24 17:50:24 +02:00
property.c device property: Introduce fwnode_find_reference() 2019-06-03 10:55:38 +02:00
soc.c base: soc: Export soc_device_register/unregister APIs 2019-08-05 14:56:31 -07:00
swnode.c software node: Fix node registration 2021-03-17 17:03:48 +01:00
syscore.c
topology.c topology: Create core_cpus and die_cpus sysfs attributes 2019-05-23 10:08:34 +02:00
transport_class.c