summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc.rs
diff options
context:
space:
mode:
authorZijun Hu <zijun.hu@oss.qualcomm.com>2025-09-03 19:37:22 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-09-06 20:12:36 +0200
commit4c48aed6dfcd32ea23e52adc1072405a62facf46 (patch)
treeb4c55aec14dd31ade72c8b127dac526205a30528 /rust/kernel/alloc.rs
parenteca710386972f2a72708b0b2a615eb150d218e18 (diff)
driver core: auxiliary bus: Optimize logic of auxiliary_match_id()
auxiliary_match_id() repeatedly calculates variable @match_size in the for loop, however, the variable is fixed actually, so it is enough to only calculate the variable once. Besides, the function should return directly if name of the @auxdev does not include '.', but it still iterates over the ID table. Additionally, statement 'dev_name(&auxdev->dev)' is fixed, but may be evaluated more than 3 times. Optimize logic of the function by: - Move the logic calculating the variable out of the for loop - Return NULL directly if @p == NULL - Give the statement an dedicated local variable @auxdev_name Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250903-fix_auxbus-v2-1-3eae8374fd65@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/kernel/alloc.rs')
0 files changed, 0 insertions, 0 deletions