On Wed, Sep 16, 2020 at 09:04:40AM -0300, Jason Gunthorpe wrote: > 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 It is a problem if roce device returned -ENODEV. I don't want to paper-out this case by setting index = 0. Thanks > > Jason