container_of() never returns NULL. Hence remove the code that tests
whether container_of() returns NULL.

Signed-off-by: Bart Van Assche <[email protected]>
Cc: Alex Chiang <[email protected]>
Cc: <[email protected]>
---
 drivers/infiniband/core/user_mad.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/core/user_mad.c 
b/drivers/infiniband/core/user_mad.c
index f0d588f..e61287c 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -783,10 +783,7 @@ static int ib_umad_open(struct inode *inode, struct file 
*filp)
        int ret;
        port = container_of(inode->i_cdev, struct ib_umad_port, cdev);
-       if (port)
-               kref_get(&port->umad_dev->ref);
-       else
-               return -ENXIO;
+       kref_get(&port->umad_dev->ref);
        mutex_lock(&port->file_mutex);
 @@ -880,10 +877,7 @@ static int ib_umad_sm_open(struct inode *inode, struct 
file *filp)
        int ret;
        port = container_of(inode->i_cdev, struct ib_umad_port, sm_cdev);
-       if (port)
-               kref_get(&port->umad_dev->ref);
-       else
-               return -ENXIO;
+       kref_get(&port->umad_dev->ref);
        if (filp->f_flags & O_NONBLOCK) {
                if (down_trylock(&port->sm_sem)) {
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to