From: Dan Carpenter Date: Fri, 8 Sep 2023 07:03:37 +0000 (+0300) Subject: net: microchip: sparx5: clean up error checking in vcap_show_admin() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=788f63c4dc1780c84deb5fe820f6446c28364a0d;p=linux.git net: microchip: sparx5: clean up error checking in vcap_show_admin() The vcap_decode_rule() never returns NULL. There is no need to check for that. This code assumes that if it did return NULL we should end abruptly and return success. It is confusing. Fix the check to just be if (IS_ERR()) instead of if (IS_ERR_OR_NULL()). Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202309070831.hTvj9ekP-lkp@intel.com/ Signed-off-by: Dan Carpenter Reviewed-by: Simon Horman Reviewed-by: Daniel Machon Link: https://lore.kernel.org/r/b88eba86-9488-4749-a896-7c7050132e7b@moroto.mountain Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c index c2c3397c5898d..59bfbda29bb3d 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c @@ -300,7 +300,7 @@ static int vcap_show_admin(struct vcap_control *vctrl, vcap_show_admin_info(vctrl, admin, out); list_for_each_entry(elem, &admin->rules, list) { vrule = vcap_decode_rule(elem); - if (IS_ERR_OR_NULL(vrule)) { + if (IS_ERR(vrule)) { ret = PTR_ERR(vrule); break; }