lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Nov 2017 13:37:05 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
Cc:     Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

Hi Maciej

I don't particularly like the

       if (!phy->link)
                goto out_change_speed;

part of the existing code. Makes me thing of BASIC. goto is good for
error handling, but this is not an error.

If you feel like it, maybe you can refactor this code? Add a function like:

phy_led_trigger_no_link(struct phy_device *phy)
{
        if (phy->last_triggered) {
                led_trigger_event(&phy->last_triggered->trigger,
                                  LED_OFF);
                phy->last_triggered = NULL;
        }
}

and call it, rather than using goto? It then becomes a lot more
obvious what your change is doing, turning the LED off when there is
no link.

Thanks
   Andrew

Powered by blists - more mailing lists