On Tue, Feb 18, 2020 at 12:17:40PM +0200, Kamal Heib wrote: > Avoid printing the following error when modify_port isn't supported. > > [47541.541145] ib_srpt disabling MAD processing failed. > > Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1") > Signed-off-by: Kamal Heib <kamalheib1@xxxxxxxxx> > drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c > index 98552749d71c..eba2b156616d 100644 > +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c > @@ -628,12 +628,14 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) > .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP, > }; > struct srpt_port *sport; > + int ret; > int i; > > for (i = 1; i <= sdev->device->phys_port_cnt; i++) { > sport = &sdev->port[i - 1]; > WARN_ON(sport->port != i); > - if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0) > + ret = ib_modify_port(sdev->device, i, 0, &port_modify); > + if (ret < 0 && ret != -EOPNOTSUPP) > pr_err("disabling MAD processing failed.\n"); > if (sport->mad_agent) { > ib_unregister_mad_agent(sport->mad_agent); This logic is goofy if the original ib_modify_port fails then sport->mad_agent should be NULL so it should just skip it anyhow. If it is fixed up then we won't get the EOPNOTSUPP anymore. I'm also unclear what this IB_PORT_DEVICE_MGMT_SUP is all about, it is weird that a ULP is touching a device global flag like this Jason