[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YyL1GSD42kib8iZM@kadam>
Date: Thu, 15 Sep 2022 12:49:13 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Yu Zhe <yuzhe@...china.com>
Cc: rafal@...ecki.pl, bcm-kernel-feedback-list@...adcom.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
liqiong@...china.com
Subject: Re: [PATCH] net: broadcom: bcm4908enet: add platform_get_irq_byname
error checking
On Mon, Sep 12, 2022 at 02:29:17PM +0300, Dan Carpenter wrote:
> On Fri, Sep 09, 2022 at 02:25:45PM +0800, Yu Zhe wrote:
> > The platform_get_irq_byname() function returns negative error codes on error,
> > check it.
> >
> > Signed-off-by: Yu Zhe <yuzhe@...china.com>
> > ---
> > drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
> > index c131d8118489..d985056db6c2 100644
> > --- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
> > +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
> > @@ -705,6 +705,8 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
> > return netdev->irq;
> >
> > enet->irq_tx = platform_get_irq_byname(pdev, "tx");
> > + if (enet->irq_tx < 0)
> > + return enet->irq_tx;
> >
>
> If you read the driver, then you will see that this is deliberate.
> Search for irq_tx and read the comments. I'm not a subsystem expert so
> I don't know if this an ideal way to write the code, but it's done
> deliberately so please don't change it unless you can test it.
Btw, my comment of "don't change it unless you can test it" only applies
to this specific IRQ... We constantly apply untested patches. I have
submitted my share of buggy patches. I don't want to discourage you
from your static analysis work.
regards,
dan carpenter
Powered by blists - more mailing lists