• Daniel Mack's avatar
    net: ethernet: cpsw: improve interrupt lookup logic in cpsw_probe() · c2b32e58
    Daniel Mack authored
    Simplify the interrupt resource lookup code in cpsw_probe() by the
    following:
    
     * Only look at the first member of the resource. As the driver only
       works for DT-enabled platforms anyway, a resource of type
       IORESOURCE_IRQ will only contain one single entry
       (res->start == res->end), so there is no need for the iteration.
    
     * Add a bounds check to avoid overflows if we are passed more than
       ARRAY_SIZE(priv->irqs_table) resources.
    
     * Assign 'ret' with the return value of devm_request_irq() so that
       cpsw_probe() returns the appropriate error code.
    
     * If devm_request_irq() fails, report the error code in the log
       message.
    Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
    Acked-by: default avatarMugunthan V N <mugunthanvnm@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c2b32e58
cpsw.c 64.8 KB