aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-02-07 17:35:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-02-07 17:35:19 -0500
commit6bd113f1f4a8c0d05c4dbadb300319e0e3526db4 (patch)
treef357b1130950d8de320885810eb27fe574f6ebf5 /drivers
parent95025d6b27721ae8bbce592403fdc06e982204c8 (diff)
parent715252d41912941efb791a7b7bad94d2614dc5c3 (diff)
Merge tag 'ib-srpt-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Cleanups and error path fixes for the new SRP (SCSI RDMA protocol) target. * tag 'ib-srpt-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: IB/srpt: Don't return freed pointer from srpt_alloc_ioctx_ring() IB/srpt: Fix ERR_PTR() vs. NULL checking confusion IB/srpt: Remove unneeded <linux/version.h> include IB/srpt: Use ARRAY_SIZE() instead of open-coding IB/srpt: Use DEFINE_SPINLOCK()/LIST_HEAD()
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c17
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.h1
2 files changed, 7 insertions, 11 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index cd5d05e22a7..2b73d43cd69 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -69,8 +69,8 @@ MODULE_LICENSE("Dual BSD/GPL");
69 */ 69 */
70 70
71static u64 srpt_service_guid; 71static u64 srpt_service_guid;
72static spinlock_t srpt_dev_lock; /* Protects srpt_dev_list. */ 72static DEFINE_SPINLOCK(srpt_dev_lock); /* Protects srpt_dev_list. */
73static struct list_head srpt_dev_list; /* List of srpt_device structures. */ 73static LIST_HEAD(srpt_dev_list); /* List of srpt_device structures. */
74 74
75static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE; 75static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE;
76module_param(srp_max_req_size, int, 0444); 76module_param(srp_max_req_size, int, 0444);
@@ -687,6 +687,7 @@ err:
687 while (--i >= 0) 687 while (--i >= 0)
688 srpt_free_ioctx(sdev, ring[i], dma_size, dir); 688 srpt_free_ioctx(sdev, ring[i], dma_size, dir);
689 kfree(ring); 689 kfree(ring);
690 ring = NULL;
690out: 691out:
691 return ring; 692 return ring;
692} 693}
@@ -2595,7 +2596,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2595 } 2596 }
2596 2597
2597 ch->sess = transport_init_session(); 2598 ch->sess = transport_init_session();
2598 if (!ch->sess) { 2599 if (IS_ERR(ch->sess)) {
2599 rej->reason = __constant_cpu_to_be32( 2600 rej->reason = __constant_cpu_to_be32(
2600 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); 2601 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2601 pr_debug("Failed to create session\n"); 2602 pr_debug("Failed to create session\n");
@@ -3264,8 +3265,7 @@ static void srpt_add_one(struct ib_device *device)
3264 for (i = 0; i < sdev->srq_size; ++i) 3265 for (i = 0; i < sdev->srq_size; ++i)
3265 srpt_post_recv(sdev, sdev->ioctx_ring[i]); 3266 srpt_post_recv(sdev, sdev->ioctx_ring[i]);
3266 3267
3267 WARN_ON(sdev->device->phys_port_cnt 3268 WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
3268 > sizeof(sdev->port)/sizeof(sdev->port[0]));
3269 3269
3270 for (i = 1; i <= sdev->device->phys_port_cnt; i++) { 3270 for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
3271 sport = &sdev->port[i - 1]; 3271 sport = &sdev->port[i - 1];
@@ -4010,13 +4010,10 @@ static int __init srpt_init_module(void)
4010 goto out; 4010 goto out;
4011 } 4011 }
4012 4012
4013 spin_lock_init(&srpt_dev_lock);
4014 INIT_LIST_HEAD(&srpt_dev_list);
4015
4016 ret = -ENODEV;
4017 srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); 4013 srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt");
4018 if (!srpt_target) { 4014 if (IS_ERR(srpt_target)) {
4019 printk(KERN_ERR "couldn't register\n"); 4015 printk(KERN_ERR "couldn't register\n");
4016 ret = PTR_ERR(srpt_target);
4020 goto out; 4017 goto out;
4021 } 4018 }
4022 4019
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h
index b4b4bbcd7f1..61e52b83081 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -35,7 +35,6 @@
35#ifndef IB_SRPT_H 35#ifndef IB_SRPT_H
36#define IB_SRPT_H 36#define IB_SRPT_H
37 37
38#include <linux/version.h>
39#include <linux/types.h> 38#include <linux/types.h>
40#include <linux/list.h> 39#include <linux/list.h>
41#include <linux/wait.h> 40#include <linux/wait.h>