[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210413171137.0dd9814a@thinkpad>
Date: Tue, 13 Apr 2021 17:11:37 +0200
From: Marek BehĂșn <kabel@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Russell King <rmk+kernel@...linux.org.uk>, kuba@...nel.org
Subject: Re: [PATCH net-next 1/5] net: phy: marvell: refactor HWMON OOP
style
On Tue, 13 Apr 2021 16:36:35 +0200
Andrew Lunn <andrew@...n.ch> wrote:
> > +static int marvell_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> > + u32 attr, int channel, long *temp)
> > {
> > struct phy_device *phydev = dev_get_drvdata(dev);
> > - int err;
> > + const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev);
> > + int err = -EOPNOTSUPP;
> >
> > switch (attr) {
> > case hwmon_temp_input:
> > - err = m88e6390_get_temp(phydev, temp);
> > + if (ops->get_temp)
> > + err = ops->get_temp(phydev, temp);
> > + break;
> > + case hwmon_temp_crit:
> > + if (ops->get_temp_critical)
> > + err = ops->get_temp_critical(phydev, temp);
> > + break;
> > + case hwmon_temp_max_alarm:
> > + if (ops->get_temp_alarm)
> > + err = ops->get_temp_alarm(phydev, temp);
> > break;
> > default:
> > - return -EOPNOTSUPP;
> > + fallthrough;
> > + }
>
> Does the default clause actually service any purpose?
>
> And it is not falling through, it is falling out :-)
>
> Andrew
Seem like I forgot to remove a line :)
Powered by blists - more mailing lists