Subject: Re: Printing the driver name as part of the netdev watchdog message

From: Wang Chen <[email-masked]>
Date: Mon, 07 Jul 2008 09:51:30 +0800

Arjan van de Ven said the following on 2008-7-7 7:56:
> +void netdev_drivername(struct net_device *dev, char *buffer, int len)
> +{
> +	struct device_driver *driver;
> +	struct device *parent;
> +	struct ethtool_drvinfo info;
> +	const struct ethtool_ops *ops = dev->ethtool_ops;
> +
> +	if (len <= 0)
> +		return;
> +	buffer[0] = 0;
> +
> +	if (ops->get_drvinfo) {

if (ops && ops->get_drvinfo)

> +		memset(&info, 0, sizeof(info));
> +		info.cmd = ETHTOOL_GDRVINFO;
> +		ops->get_drvinfo(dev, &info);
> +		strlcpy(buffer, info.driver, len);
> +		if (strlen(info.driver) > 0)
> +			return;
> +	}

seems the logic should be:
if (strlen(info.driver) > 0) {
	strlcpy(buffer, info.driver, len);
	return;
}