Skip to content

Commit

Permalink
net: remove duplicate code.
Browse files Browse the repository at this point in the history
netdev_rx_handler_register() checks to see if the handler is already
busy which was recently separated into netdev_is_rx_handler_busy(). So
use the same function inside register() to avoid code duplication.
Essentially this change should be a no-op

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mahesh Bandewar authored and David S. Miller committed Jan 20, 2017
1 parent 264b87f commit 1b7cd00
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3961,9 +3961,7 @@ int netdev_rx_handler_register(struct net_device *dev,
rx_handler_func_t *rx_handler,
void *rx_handler_data)
{
ASSERT_RTNL();

if (dev->rx_handler)
if (netdev_is_rx_handler_busy(dev))
return -EBUSY;

/* Note: rx_handler_data must be set before rx_handler */
Expand Down

0 comments on commit 1b7cd00

Please sign in to comment.