All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andre Werner <andre.werner@systec-electronic.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: adin1100: Fix nullptr exception for phy interrupts
Date: Thu, 18 Jan 2024 17:20:46 +0000	[thread overview]
Message-ID: <Zald7u8B+uKzCn42@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240118104341.10832-1-andre.werner@systec-electronic.com>

In addition to Andrew's comments:

On Thu, Jan 18, 2024 at 11:43:41AM +0100, Andre Werner wrote:
> +static int adin_config_intr(struct phy_device *phydev)
> +{
> +	int ret, regval;
> +
> +	ret = adin_phy_ack_intr(phydev);
> +
> +	if (ret)
> +		return ret;
> +
> +	regval = phy_read_mmd(phydev, MDIO_MMD_VEND2, ADIN_PHY_SUBSYS_IRQ_MASK);
> +	if (regval < 0)
> +		return regval;
> +
> +	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
> +		regval |= ADIN_LINK_STAT_CHNG_IRQ_EN;
> +	else
> +		regval &= ~ADIN_LINK_STAT_CHNG_IRQ_EN;
> +
> +	ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
> +			    ADIN_PHY_SUBSYS_IRQ_MASK,
> +			    regval);
> +	return ret;

	u16 irq_mask;

	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
		irq_mask = ADIN_LINK_STAT_CHNG_IRQ_EN;
	else
		irq_mask = 0;

	return phy_modify_mmd(phydev, MDIO_MMD_VEND2,
			      ADIN_PHY_SUBSYS_IRQ_MASK,
			      ADIN_LINK_STAT_CHNG_IRQ_EN, irq_mask);

> +}
> +
> +static irqreturn_t adin_phy_handle_interrupt(struct phy_device *phydev)
> +{
> +	int irq_status;
> +
> +	irq_status = phy_read_mmd(phydev, MDIO_MMD_VEND2, ADIN_PHY_SUBSYS_IRQ_STATUS);

Probably want to wrap this - if you're going to bother wrapping your
phy_write_mmd() above because it overflows 80 columns, then please do
so consistently.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  parent reply	other threads:[~2024-01-18 17:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 10:43 [PATCH] net: phy: adin1100: Fix nullptr exception for phy interrupts Andre Werner
2024-01-18 16:53 ` Andrew Lunn
2024-01-18 17:36   ` Heiner Kallweit
2024-01-18 20:09     ` Andrew Lunn
2024-01-18 21:24       ` Heiner Kallweit
2024-01-18 23:34         ` Russell King (Oracle)
2024-01-19  6:30         ` Andre Werner
2024-01-18 17:20 ` Russell King (Oracle) [this message]
2024-01-19  3:05   ` Andre Werner
2024-01-19  9:56     ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zald7u8B+uKzCn42@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andre.werner@systec-electronic.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.