lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHWsc3H8RzmdfvuR@lunn.ch>
Date:   Tue, 13 Apr 2021 16:36:35 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Marek BehĂșn <kabel@...nel.org>
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

> +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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ