[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 6 Jun 2017 09:11:51 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jiri Pirko' <jiri@...nulli.us>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"idosch@...lanox.com" <idosch@...lanox.com>,
"petrm@...lanox.com" <petrm@...lanox.com>,
"mlxsw@...lanox.com" <mlxsw@...lanox.com>
Subject: RE: [patch net-next 3/3] mlxsw: spectrum_router: Align RIF index
allocation with existing code
From: Jiri Pirko
> Sent: 04 June 2017 15:54
> The way we usually allocate an index is by letting the allocation
> function return an error instead of an invalid index.
...
> -static int mlxsw_sp_avail_rif_get(struct mlxsw_sp *mlxsw_sp)
> +static int mlxsw_sp_rif_index_alloc(struct mlxsw_sp *mlxsw_sp, u16 *p_rif_index)
You typically get much better code from returning an invalid index.
This is why PTR_ERR() exists.
David
Powered by blists - more mailing lists