On Wed, Sep 16, 2020 at 01:37:10PM +0300, Leon Romanovsky wrote: > It depends on how you want to treat errors from rdma_read_gid_attr_ndev_rcu(). > Current check allows us to ensure that any error returned by this call is > handled. > > Otherwise we will find ourselves with something like this: > ndev = rdma_read_gid_attr_ndev_rcu(gid_attr); > if (IS_ERR(ndev)) { > if (rdma_protocol_roce()) > goto error; > if (ERR_PTR(ndev) != -ENODEV) > goto error; > } Isn't it just if (IS_ERR(ndev)) { if (ERR_PTR(ndev) != -ENODEV) goto error; index = -1; } Which seems fine and clear enough Jason