Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

include: trace: Fix inflight count helper on failed initialization

Add a check to the scmi_inflight_count() helper to handle the case
when the SCMI debug subsystem fails to initialize.

Fixes: f8e656382b4a ("include: trace: Add tracepoint support for inflight xfer count")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Message-Id: <20251014115346.2391418-2-cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

authored by

Cristian Marussi and committed by
Sudeep Holla
289ce7e9 2290ab43

+10 -5
+5 -3
drivers/firmware/arm_scmi/common.h
··· 333 333 } 334 334 } 335 335 336 - static inline void scmi_dec_count(atomic_t *arr, int stat) 336 + static inline void scmi_dec_count(struct scmi_debug_info *dbg, int stat) 337 337 { 338 - if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) 339 - atomic_dec(&arr[stat]); 338 + if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) { 339 + if (dbg) 340 + atomic_dec(&dbg->counters[stat]); 341 + } 340 342 } 341 343 342 344 enum scmi_bad_msg {
+5 -2
drivers/firmware/arm_scmi/driver.c
··· 594 594 /* Set in-flight */ 595 595 set_bit(xfer->hdr.seq, minfo->xfer_alloc_table); 596 596 hash_add(minfo->pending_xfers, &xfer->node, xfer->hdr.seq); 597 - scmi_inc_count(info->dbg->counters, XFERS_INFLIGHT); 597 + scmi_inc_count(info->dbg, XFERS_INFLIGHT); 598 598 599 599 xfer->pending = true; 600 600 } ··· 803 803 hash_del(&xfer->node); 804 804 xfer->pending = false; 805 805 806 - scmi_dec_count(info->dbg->counters, XFERS_INFLIGHT); 806 + scmi_dec_count(info->dbg, XFERS_INFLIGHT); 807 807 } 808 808 hlist_add_head(&xfer->node, &minfo->free_xfers); 809 809 } ··· 3406 3406 { 3407 3407 if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) { 3408 3408 struct scmi_info *info = handle_to_scmi_info(handle); 3409 + 3410 + if (!info->dbg) 3411 + return 0; 3409 3412 3410 3413 return atomic_read(&info->dbg->counters[XFERS_INFLIGHT]); 3411 3414 } else {