RDMA/core: Fix return code when modify_device isn't supported
authorKamal Heib <kamalheib1@gmail.com>
Mon, 23 Sep 2019 10:41:56 +0000 (13:41 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 1 Oct 2019 16:06:10 +0000 (13:06 -0300)
The proper return code is "-EOPNOTSUPP" when modify_device callback is not
supported.

Link: https://lore.kernel.org/r/20190923104158.5331-2-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/device.c
drivers/infiniband/core/sysfs.c

index 99c4a55545cfba00812824c87ac56c4b0a2acd20..a667636f74bfb1747adcfdbb7650e85cca0de395 100644 (file)
@@ -2365,7 +2365,7 @@ int ib_modify_device(struct ib_device *device,
                     struct ib_device_modify *device_modify)
 {
        if (!device->ops.modify_device)
-               return -ENOSYS;
+               return -EOPNOTSUPP;
 
        return device->ops.modify_device(device, device_modify_mask,
                                         device_modify);
index 7a50cedcef1f60b9b24a2e610dd01c87b59a6c1c..92c932c067cb186b3f9b1c6589b294c773208cae 100644 (file)
@@ -1268,7 +1268,7 @@ static ssize_t node_desc_store(struct device *device,
        int ret;
 
        if (!dev->ops.modify_device)
-               return -EIO;
+               return -EOPNOTSUPP;
 
        memcpy(desc.node_desc, buf, min_t(int, count, IB_DEVICE_NODE_DESC_MAX));
        ret = ib_modify_device(dev, IB_DEVICE_MODIFY_NODE_DESC, &desc);