public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ia64: topology: Fix an error handling path in cache_add_dev()
@ 2022-03-28 19:07 Christophe JAILLET
  2022-03-28 19:07 ` [PATCH 2/2] ia64: topology: Slightly simplify code Christophe JAILLET
  2022-03-28 19:16 ` [PATCH 1/2] ia64: topology: Fix an error handling path in cache_add_dev() John Paul Adrian Glaubitz
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-03-28 19:07 UTC (permalink / raw)
  To: Tony Luck, Zhang Yanmin
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-ia64

If kobject_init_and_add()fails, kobject_put() needs to be called.
Add the missing call which is already there a few lines below in another
error handling path.

Fixes: f19180056ea0 ("[IA64] Export cpu cache info by sysfs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is provided as-is and is not even compile tested. I don't have the
cross-building toolchain for that.
---
 arch/ia64/kernel/topology.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 94a848b06f15..6adb84f05cbb 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -354,6 +354,7 @@ static int cache_add_dev(unsigned int cpu)
 				      &cache_ktype_percpu_entry, &sys_dev->kobj,
 				      "%s", "cache");
 	if (unlikely(retval < 0)) {
+		kobject_put(&all_cpu_cache_info[cpu].kobj);
 		cpu_cache_sysfs_exit(cpu);
 		return retval;
 	}
-- 
2.32.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-28 20:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-28 19:07 [PATCH 1/2] ia64: topology: Fix an error handling path in cache_add_dev() Christophe JAILLET
2022-03-28 19:07 ` [PATCH 2/2] ia64: topology: Slightly simplify code Christophe JAILLET
2022-03-28 19:16 ` [PATCH 1/2] ia64: topology: Fix an error handling path in cache_add_dev() John Paul Adrian Glaubitz
2022-03-28 19:45   ` Christophe JAILLET
2022-03-28 20:07     ` John Paul Adrian Glaubitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox