diff options
author | David S. Miller <davem@davemloft.net> | 2011-06-06 19:41:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-06 19:41:33 -0400 |
commit | 3019de124b9f5b1526cb3668b74af14371e21795 (patch) | |
tree | 3b4fd5843b61f3a860824ec38827cf0256620eed /net | |
parent | 5a079c305ad4dda9708b7a29db4a8bd38e21c3a6 (diff) |
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')
-rw-r--r-- | net/core/dev.c | 16 | ||||
-rw-r--r-- | net/sched/sch_generic.c | 3 |
2 files changed, 6 insertions, 13 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 939307891e71..1af6cb27f67a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -6264,29 +6264,23 @@ err_name: | |||
6264 | /** | 6264 | /** |
6265 | * netdev_drivername - network driver for the device | 6265 | * netdev_drivername - network driver for the device |
6266 | * @dev: network device | 6266 | * @dev: network device |
6267 | * @buffer: buffer for resulting name | ||
6268 | * @len: size of buffer | ||
6269 | * | 6267 | * |
6270 | * Determine network driver for device. | 6268 | * Determine network driver for device. |
6271 | */ | 6269 | */ |
6272 | char *netdev_drivername(const struct net_device *dev, char *buffer, int len) | 6270 | const char *netdev_drivername(const struct net_device *dev) |
6273 | { | 6271 | { |
6274 | const struct device_driver *driver; | 6272 | const struct device_driver *driver; |
6275 | const struct device *parent; | 6273 | const struct device *parent; |
6276 | 6274 | const char *empty = ""; | |
6277 | if (len <= 0 || !buffer) | ||
6278 | return buffer; | ||
6279 | buffer[0] = 0; | ||
6280 | 6275 | ||
6281 | parent = dev->dev.parent; | 6276 | parent = dev->dev.parent; |
6282 | |||
6283 | if (!parent) | 6277 | if (!parent) |
6284 | return buffer; | 6278 | return empty; |
6285 | 6279 | ||
6286 | driver = parent->driver; | 6280 | driver = parent->driver; |
6287 | if (driver && driver->name) | 6281 | if (driver && driver->name) |
6288 | strlcpy(buffer, driver->name, len); | 6282 | return driver->name; |
6289 | return buffer; | 6283 | return empty; |
6290 | } | 6284 | } |
6291 | 6285 | ||
6292 | static int __netdev_printk(const char *level, const struct net_device *dev, | 6286 | static int __netdev_printk(const char *level, const struct net_device *dev, |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index b1721d71c27c..b4c680900d7a 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -251,9 +251,8 @@ static void dev_watchdog(unsigned long arg) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | if (some_queue_timedout) { | 253 | if (some_queue_timedout) { |
254 | char drivername[64]; | ||
255 | WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", | 254 | WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", |
256 | dev->name, netdev_drivername(dev, drivername, 64), i); | 255 | dev->name, netdev_drivername(dev), i); |
257 | dev->netdev_ops->ndo_tx_timeout(dev); | 256 | dev->netdev_ops->ndo_tx_timeout(dev); |
258 | } | 257 | } |
259 | if (!mod_timer(&dev->watchdog_timer, | 258 | if (!mod_timer(&dev->watchdog_timer, |