Subject: Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

From: Andrew Lunn <[email-masked]>
Date: Wed, 1 Nov 2017 13:37:05 +0100

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