From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: Free ATU/VTU irq only when there is chip irq Date: Tue, 16 Jan 2018 00:02:23 +0100 Message-ID: <20180115230223.GB4927@lunn.ch> References: <1516056358-4852-1-git-send-email-andrew@lunn.ch> <1516056358-4852-3-git-send-email-andrew@lunn.ch> <715ef97b-128e-3feb-a3e9-f6963cf0be49@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , netdev , Vivien Didelot To: Florian Fainelli Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:49298 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbeAOXC0 (ORCPT ); Mon, 15 Jan 2018 18:02:26 -0500 Content-Disposition: inline In-Reply-To: <715ef97b-128e-3feb-a3e9-f6963cf0be49@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Jan 15, 2018 at 02:54:22PM -0800, Florian Fainelli wrote: > On 01/15/2018 02:45 PM, Andrew Lunn wrote: > > We only register the ATU and VTU irq when we have a chip level IRQ. > > In the error path, we should only attempt to remove the ATU and VTU > > irq if we also have a chip level IRQ. > > > > Signed-off-by: Andrew Lunn > > --- > > drivers/net/dsa/mv88e6xxx/chip.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c > > index 54cb00a27408..eb328bade225 100644 > > --- a/drivers/net/dsa/mv88e6xxx/chip.c > > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > > @@ -3999,9 +3999,11 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) > > out_mdio: > > mv88e6xxx_mdios_unregister(chip); > > out_g1_vtu_prob_irq: > > - mv88e6xxx_g1_vtu_prob_irq_free(chip); > > + if (chip->irq > 0) > > + mv88e6xxx_g1_vtu_prob_irq_free(chip); > > Why not move this check to mv88e6xxx_g1_vtu_prob_irq_free() and make it > a no-op if chip->irq <= 0? Hi Florian It keeps it symmetrical with the setup code: if (chip->irq > 0) { /* Has to be performed before the MDIO bus is created, * because the PHYs will link there interrupts to these * interrupt controllers */ mutex_lock(&chip->reg_lock); err = mv88e6xxx_g1_irq_setup(chip); mutex_unlock(&chip->reg_lock); if (err) goto out; if (chip->info->g2_irqs > 0) { err = mv88e6xxx_g2_irq_setup(chip); if (err) goto out_g1_irq; } err = mv88e6xxx_g1_atu_prob_irq_setup(chip); if (err) goto out_g2_irq; err = mv88e6xxx_g1_vtu_prob_irq_setup(chip); if (err) goto out_g1_atu_prob_irq; } The general flow in probe() is to only call functions if they are needed. So i would prefer to keep to that. Andrew