lkml.org 
[lkml]   [2020]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 08/48] sfp: Fix error handing in sfp_probe()
    Date
    From: YueHaibing <yuehaibing@huawei.com>

    [ Upstream commit 9621618130bf7e83635367c13b9a6ee53935bb37 ]

    gpiod_to_irq() never return 0, but returns negative in
    case of error, check it and set gpio_irq to 0.

    Fixes: 73970055450e ("sfp: add SFP module support")
    Signed-off-by: YueHaibing <yuehaibing@huawei.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://lore.kernel.org/r/20201031031053.25264-1-yuehaibing@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/phy/sfp.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    --- a/drivers/net/phy/sfp.c
    +++ b/drivers/net/phy/sfp.c
    @@ -881,7 +881,8 @@ static int sfp_probe(struct platform_dev
    continue;

    irq = gpiod_to_irq(sfp->gpio[i]);
    - if (!irq) {
    + if (irq < 0) {
    + irq = 0;
    poll = true;
    continue;
    }

    \
     
     \ /
      Last update: 2020-11-09 14:34    [W:4.213 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site