Message ID | 20230818050505.3634668-2-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | net: Update and fix return value check for vcap_get_rule() | expand |
On Fri, Aug 18, 2023 at 01:05:03PM +0800, Ruan Jinjie wrote: > As Simon Horman suggests, update vcap_get_rule() to always > return an ERR_PTR() and update the error detection conditions to > use IS_ERR(), which would be more cleaner in this case. > > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> > Suggested-by: Simon Horman <horms@kernel.org> > --- > drivers/net/ethernet/microchip/vcap/vcap_api.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c index a7b43f99bc80..300fe1a93dce 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c @@ -2429,7 +2429,7 @@ struct vcap_rule *vcap_get_rule(struct vcap_control *vctrl, u32 id) elem = vcap_get_locked_rule(vctrl, id); if (!elem) - return NULL; + return ERR_PTR(-ENOENT); rule = vcap_decode_rule(elem); mutex_unlock(&elem->admin->lock);
As Simon Horman suggests, update vcap_get_rule() to always return an ERR_PTR() and update the error detection conditions to use IS_ERR(), which would be more cleaner in this case. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Suggested-by: Simon Horman <horms@kernel.org> --- drivers/net/ethernet/microchip/vcap/vcap_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)