Commit 75834577 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

ice: Fix a couple NULL vs IS_ERR() bugs

The ice_repr_create() function returns error pointers.  It never returns
NULL.  Fix the callers to check for IS_ERR().

Fixes: 977514fb ("ice: create port representor for SF")
Fixes: 415db839 ("ice: make representor code generic")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/7f7aeb91-8771-47b8-9275-9d9f64f947dd@stanley.mountainSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c209847b
...@@ -452,8 +452,8 @@ struct ice_repr *ice_repr_create_vf(struct ice_vf *vf) ...@@ -452,8 +452,8 @@ struct ice_repr *ice_repr_create_vf(struct ice_vf *vf)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
repr = ice_repr_create(vsi); repr = ice_repr_create(vsi);
if (!repr) if (IS_ERR(repr))
return ERR_PTR(-ENOMEM); return repr;
repr->type = ICE_REPR_TYPE_VF; repr->type = ICE_REPR_TYPE_VF;
repr->vf = vf; repr->vf = vf;
...@@ -501,8 +501,8 @@ struct ice_repr *ice_repr_create_sf(struct ice_dynamic_port *sf) ...@@ -501,8 +501,8 @@ struct ice_repr *ice_repr_create_sf(struct ice_dynamic_port *sf)
{ {
struct ice_repr *repr = ice_repr_create(sf->vsi); struct ice_repr *repr = ice_repr_create(sf->vsi);
if (!repr) if (IS_ERR(repr))
return ERR_PTR(-ENOMEM); return repr;
repr->type = ICE_REPR_TYPE_SF; repr->type = ICE_REPR_TYPE_SF;
repr->sf = sf; repr->sf = sf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment