diff mbox

[1/3] IB/umad: Remove container_of() != NULL tests

Message ID 537091B6.5000007@acm.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Bart Van Assche May 12, 2014, 9:17 a.m. UTC
container_of() never returns NULL. Hence remove the code that tests
whether container_of() returns NULL.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Alex Chiang <achiang@hp.com>
Cc: <stable@vger.kernel.org>
---
 drivers/infiniband/core/user_mad.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

-	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)) {
diff mbox

Patch

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);