Re: [PATCH] locking/lockdep: Remove unused variable in __lockdep_count*()

From: chi wu
Date: Mon Oct 31 2022 - 01:58:48 EST


Waiman Long <longman@xxxxxxxxxx> 于2022年10月30日周日 23:21写道:
>
> There is no target_entry NULL check in __bfs(), so target_entry is
> always expected to point to a valid memory location. You will need to
> add the NULL check if you want to remove it from these two functions.
>
Yes, add code in __bfs() as follow?

if (match(lock, data)) {
if (target_entry)
*target_entry = lock;
return BFS_RMATCH;
}

> BTW, have you actually exercised the code to make sure that there was no
> unexpected side effect from this change?
Yes, the code "check_irq_usage -> __bfs_backwards" is an example and the
primary callers lockdep_stats_show and l_show in lockdep_proc.c work well.

But I'm not sure I missed anything.
>
> Cheers,
> Longman
>
Thank you for reply