Skip to content

Commit 7583457

Browse files
Dan Carpenterkuba-moo
authored andcommitted
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: 977514f ("ice: create port representor for SF") Fixes: 415db83 ("ice: make representor code generic") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c209847 commit 7583457

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/ethernet/intel/ice/ice_repr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ struct ice_repr *ice_repr_create_vf(struct ice_vf *vf)
452452
return ERR_PTR(-EINVAL);
453453

454454
repr = ice_repr_create(vsi);
455-
if (!repr)
456-
return ERR_PTR(-ENOMEM);
455+
if (IS_ERR(repr))
456+
return repr;
457457

458458
repr->type = ICE_REPR_TYPE_VF;
459459
repr->vf = vf;
@@ -501,8 +501,8 @@ struct ice_repr *ice_repr_create_sf(struct ice_dynamic_port *sf)
501501
{
502502
struct ice_repr *repr = ice_repr_create(sf->vsi);
503503

504-
if (!repr)
505-
return ERR_PTR(-ENOMEM);
504+
if (IS_ERR(repr))
505+
return repr;
506506

507507
repr->type = ICE_REPR_TYPE_SF;
508508
repr->sf = sf;

0 commit comments

Comments
 (0)