hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/kernel/irq/irqdesc.c
....@@ -31,7 +31,7 @@
3131 cpulist_parse(str, irq_default_affinity);
3232 /*
3333 * Set at least the boot cpu. We don't want to end up with
34
- * bugreports caused by random comandline masks
34
+ * bugreports caused by random commandline masks
3535 */
3636 cpumask_set_cpu(smp_processor_id(), irq_default_affinity);
3737 return 1;
....@@ -288,22 +288,25 @@
288288 if (irq_kobj_base) {
289289 /*
290290 * Continue even in case of failure as this is nothing
291
- * crucial.
291
+ * crucial and failures in the late irq_sysfs_init()
292
+ * cannot be rolled back.
292293 */
293294 if (kobject_add(&desc->kobj, irq_kobj_base, "%d", irq))
294295 pr_warn("Failed to add kobject for irq %d\n", irq);
296
+ else
297
+ desc->istate |= IRQS_SYSFS;
295298 }
296299 }
297300
298301 static void irq_sysfs_del(struct irq_desc *desc)
299302 {
300303 /*
301
- * If irq_sysfs_init() has not yet been invoked (early boot), then
302
- * irq_kobj_base is NULL and the descriptor was never added.
303
- * kobject_del() complains about a object with no parent, so make
304
- * it conditional.
304
+ * Only invoke kobject_del() when kobject_add() was successfully
305
+ * invoked for the descriptor. This covers both early boot, where
306
+ * sysfs is not initialized yet, and the case of a failed
307
+ * kobject_add() invocation.
305308 */
306
- if (irq_kobj_base)
309
+ if (desc->istate & IRQS_SYSFS)
307310 kobject_del(&desc->kobj);
308311 }
309312