lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy
Hi Andrew,

On Wed, Nov 30, 2022 at 06:10:42PM +0100, Andrew Lunn wrote:
> This is not the first time Russell has pointed out your locking is
> wrong.
>
> How about adding a check in functions which should be called with the
> lock taken really do have the lock taken?

They already do:

lockdep_assert_held_once(&bus->mdio_lock);

but I guess people just aren't testing their code with lockdep enabled.

The only other thing I can think of trying is to use mutex_trylock():

if (WARN_ON_ONCE(mutex_trylock(&bus->mdio_lock)))
mutex_unlock(&bus->mdio_lock);

scattered throughout.

However, if the author does have lockdep enabled but ignores the
warnings, that isn't going to help.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

\
 
 \ /
  Last update: 2022-11-30 18:34    [W:0.035 / U:2.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site