IB/core: Avoid unnecessary return value check
authorParav Pandit <parav@mellanox.com>
Thu, 2 Nov 2017 13:22:27 +0000 (15:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:53:03 +0000 (09:53 +0100)
commit 2e4c85c6edc80fa532b2c7e1eb3597ef4d4bbb8f upstream.

Since there is nothing done with non zero return value, such check is
avoided.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/security.c

index 28607bb42d873ee7f1c1868e18125fa6cdbcf1d3..23278ed5be4517fd42d8bba6eb07ccd485e5f7f6 100644 (file)
@@ -697,20 +697,13 @@ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent)
 
 int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index)
 {
-       int ret;
-
        if (map->agent.qp->qp_type == IB_QPT_SMI && !map->agent.smp_allowed)
                return -EACCES;
 
-       ret = ib_security_pkey_access(map->agent.device,
-                                     map->agent.port_num,
-                                     pkey_index,
-                                     map->agent.security);
-
-       if (ret)
-               return ret;
-
-       return 0;
+       return ib_security_pkey_access(map->agent.device,
+                                      map->agent.port_num,
+                                      pkey_index,
+                                      map->agent.security);
 }
 
 #endif /* CONFIG_SECURITY_INFINIBAND */