]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - rdma/utils.c
rdma: Properly mark RDMAtool license
[mirror_iproute2.git] / rdma / utils.c
index 4840bf226d54d01cadbc46e298a7bdb4686d6aa1..bce052d5b17b11163d0f691ef8722cd9d119ef9a 100644 (file)
@@ -1,11 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 /*
  * utils.c     RDMA tool
- *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              as published by the Free Software Foundation; either version
- *              2 of the License, or (at your option) any later version.
- *
  * Authors:     Leon Romanovsky <leonro@mellanox.com>
  */
 
@@ -425,8 +420,8 @@ int rd_attr_cb(const struct nlattr *attr, void *data)
        const struct nlattr **tb = data;
        int type;
 
-       if (mnl_attr_type_valid(attr, RDMA_NLDEV_ATTR_MAX) < 0)
-               /* We received uknown attribute */
+       if (mnl_attr_type_valid(attr, RDMA_NLDEV_ATTR_MAX - 1) < 0)
+               /* We received unknown attribute */
                return MNL_CB_OK;
 
        type = mnl_attr_get_type(attr);
@@ -577,6 +572,16 @@ out:
        return ret;
 }
 
+int rd_exec_require_dev(struct rd *rd, int (*cb)(struct rd *rd))
+{
+       if (rd_no_arg(rd)) {
+               pr_err("Please provide device name.\n");
+               return -EINVAL;
+       }
+
+       return rd_exec_dev(rd, cb);
+}
+
 int rd_exec_cmd(struct rd *rd, const struct rd_cmd *cmds, const char *str)
 {
        const struct rd_cmd *c;