Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3da8adc authored by Julia Cartwright's avatar Julia Cartwright Committed by David S. Miller
Browse files

net: macb: kill useless use of list_empty()



The list_for_each_entry() macro already handles the case where the list
is empty (by not executing the loop body).  It's not necessary to handle
this case specially, so stop doing so.

Cc: Rafal Ozieblo <rafalo@cadence.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarJulia Cartwright <julia@ni.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a63b255
Loading
Loading
Loading
Loading
+12 −19
Original line number Diff line number Diff line
@@ -2812,9 +2812,6 @@ static int gem_add_flow_filter(struct net_device *netdev,
			htons(fs->h_u.tcp_ip4_spec.psrc), htons(fs->h_u.tcp_ip4_spec.pdst));

	/* find correct place to add in list */
	if (list_empty(&bp->rx_fs_list.list))
		list_add(&newfs->list, &bp->rx_fs_list.list);
	else {
	list_for_each_entry(item, &bp->rx_fs_list.list, list) {
		if (item->fs.location > newfs->fs.location) {
			list_add_tail(&newfs->list, &item->list);
@@ -2829,7 +2826,6 @@ static int gem_add_flow_filter(struct net_device *netdev,
	}
	if (!added)
		list_add_tail(&newfs->list, &bp->rx_fs_list.list);
	}

	gem_prog_cmp_regs(bp, fs);
	bp->rx_fs_list.count++;
@@ -2851,9 +2847,6 @@ static int gem_del_flow_filter(struct net_device *netdev,
	struct ethtool_rx_fs_item *item;
	struct ethtool_rx_flow_spec *fs;

	if (list_empty(&bp->rx_fs_list.list))
		return -EINVAL;

	list_for_each_entry(item, &bp->rx_fs_list.list, list) {
		if (item->fs.location == cmd->fs.location) {
			/* disable screener regs for the flow entry */