[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d555fd8-0c9b-4460-9adf-9f8c2076f39a@kili.mountain>
Date: Fri, 7 Apr 2023 18:14:33 +0300
From: Dan Carpenter <error27@...il.com>
To: Peter Lafreniere <peter@...jl.ca>
Cc: linux-hams@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] ax25: exit linked-list searches earlier
On Fri, Apr 07, 2023 at 10:20:42AM -0400, Peter Lafreniere wrote:
> diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
> index b7c4d656a94b..ed2cab200589 100644
> --- a/net/ax25/ax25_route.c
> +++ b/net/ax25/ax25_route.c
> @@ -364,6 +364,9 @@ ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
> if (ax25cmp(&ax25_rt->callsign, &null_ax25_address) == 0 && ax25_rt->dev == dev)
> ax25_def_rt = ax25_rt;
> }
> +
> + if (ax25_spe_rt != NULL)
> + break;
Better to just return directly.
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index b7c4d656a94b..a8a3ab8c92f6 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -364,13 +364,12 @@ ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
if (ax25cmp(&ax25_rt->callsign, &null_ax25_address) == 0 && ax25_rt->dev == dev)
ax25_def_rt = ax25_rt;
}
- }
- ax25_rt = ax25_def_rt;
- if (ax25_spe_rt != NULL)
- ax25_rt = ax25_spe_rt;
+ if (ax25_spe_rt)
+ return ax25_spe_rt;
+ }
- return ax25_rt;
+ return ax25_def_rt;
}
/*
Powered by blists - more mailing lists