summaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-06-06 16:41:33 -0700
committerDavid S. Miller <davem@davemloft.net>2011-06-06 16:41:33 -0700
commit3019de124b9f5b1526cb3668b74af14371e21795 (patch)
tree3b4fd5843b61f3a860824ec38827cf0256620eed /net/core/dev.c
parent5a079c305ad4dda9708b7a29db4a8bd38e21c3a6 (diff)
downloadop-kernel-dev-3019de124b9f5b1526cb3668b74af14371e21795.zip
op-kernel-dev-3019de124b9f5b1526cb3668b74af14371e21795.tar.gz
net: Rework netdev_drivername() to avoid warning.
This interface uses a temporary buffer, but for no real reason. And now can generate warnings like: net/sched/sch_generic.c: In function dev_watchdog net/sched/sch_generic.c:254:10: warning: unused variable drivername Just return driver->name directly or "". Reported-by: Connor Hansen <cmdkhh@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 9393078..1af6cb2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6264,29 +6264,23 @@ err_name:
/**
* netdev_drivername - network driver for the device
* @dev: network device
- * @buffer: buffer for resulting name
- * @len: size of buffer
*
* Determine network driver for device.
*/
-char *netdev_drivername(const struct net_device *dev, char *buffer, int len)
+const char *netdev_drivername(const struct net_device *dev)
{
const struct device_driver *driver;
const struct device *parent;
-
- if (len <= 0 || !buffer)
- return buffer;
- buffer[0] = 0;
+ const char *empty = "";
parent = dev->dev.parent;
-
if (!parent)
- return buffer;
+ return empty;
driver = parent->driver;
if (driver && driver->name)
- strlcpy(buffer, driver->name, len);
- return buffer;
+ return driver->name;
+ return empty;
}
static int __netdev_printk(const char *level, const struct net_device *dev,
OpenPOWER on IntegriCloud