forked from luck/tmp_suning_uos_patched
Cleanups and error path fixes for the new SRP (SCSI RDMA protocol) target.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABCAAGBQJPMV+vAAoJEENa44ZhAt0hP1oP/itn0EMwiII4F9TjhPjk8xaj XD2J1DIkuMYbTgi8Gn5OQ8EwoppsPIsPUd1yOiNyUm5BpvHtDWE1q6IzBx6Izn8y 2o4ZDmcc12NKBHpV0ZOgQVvGqEgsvqJ8x+qmEKI7s1t+WZjm8FZBbGh9qMtft/zW ojl7i5PwA8UhZab31xG2jHwXdU31sxk85RGrVc9NDl7OAa2kYo3owYeIhvTLyLtk erKrUVxym2iIIkUobyeel2TxDR3iRYWI4nmVsJ90b8bazVOOSxIchaWJuLkY5G/a R28UCtXRT7QQqYfzAlw0IUurUqNGPGtDORgiENzqIXbDDBs6GvPsSCG6VMDMqYmo rZIyq2LbnHsXoas03IPPrckkNfjlQs6VoM4q2mh0uB1hyHcLmeRG3wzVo0j+KXbv yL3T6PV9S69phjUwAWbJi7R/vnjhNmRoDSay0X+rQQlQBSkSZYTm48Fl2875tpPc ZBs0PgiVLzgcr1nzV1gb9iirYKQXWnlDhqIPduRbanDLg0AqMEt+Iox49934DPo3 qnvy0eQ/8X0F5O5q4F07a4vaw2lV0BoiAl5y18GcBQYtvboqhs7LRgOqW0K1+iOL VHtfEoqG6UzRl0yIsLFZ+WLM+r7ZEHgQ5C3B+shEJ3Ap0/ZqI7eKSY0cuUQZocQZ Mmk3u4+y/sz6ERYglx8H =Pr/F -----END PGP SIGNATURE----- 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()
This commit is contained in:
commit
6bd113f1f4
@ -69,8 +69,8 @@ MODULE_LICENSE("Dual BSD/GPL");
|
||||
*/
|
||||
|
||||
static u64 srpt_service_guid;
|
||||
static spinlock_t srpt_dev_lock; /* Protects srpt_dev_list. */
|
||||
static struct list_head srpt_dev_list; /* List of srpt_device structures. */
|
||||
static DEFINE_SPINLOCK(srpt_dev_lock); /* Protects srpt_dev_list. */
|
||||
static LIST_HEAD(srpt_dev_list); /* List of srpt_device structures. */
|
||||
|
||||
static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE;
|
||||
module_param(srp_max_req_size, int, 0444);
|
||||
@ -687,6 +687,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
|
||||
while (--i >= 0)
|
||||
srpt_free_ioctx(sdev, ring[i], dma_size, dir);
|
||||
kfree(ring);
|
||||
ring = NULL;
|
||||
out:
|
||||
return ring;
|
||||
}
|
||||
@ -2595,7 +2596,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
|
||||
}
|
||||
|
||||
ch->sess = transport_init_session();
|
||||
if (!ch->sess) {
|
||||
if (IS_ERR(ch->sess)) {
|
||||
rej->reason = __constant_cpu_to_be32(
|
||||
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
|
||||
pr_debug("Failed to create session\n");
|
||||
@ -3264,8 +3265,7 @@ static void srpt_add_one(struct ib_device *device)
|
||||
for (i = 0; i < sdev->srq_size; ++i)
|
||||
srpt_post_recv(sdev, sdev->ioctx_ring[i]);
|
||||
|
||||
WARN_ON(sdev->device->phys_port_cnt
|
||||
> sizeof(sdev->port)/sizeof(sdev->port[0]));
|
||||
WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
|
||||
|
||||
for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
|
||||
sport = &sdev->port[i - 1];
|
||||
@ -4010,13 +4010,10 @@ static int __init srpt_init_module(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
spin_lock_init(&srpt_dev_lock);
|
||||
INIT_LIST_HEAD(&srpt_dev_list);
|
||||
|
||||
ret = -ENODEV;
|
||||
srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt");
|
||||
if (!srpt_target) {
|
||||
if (IS_ERR(srpt_target)) {
|
||||
printk(KERN_ERR "couldn't register\n");
|
||||
ret = PTR_ERR(srpt_target);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@
|
||||
#ifndef IB_SRPT_H
|
||||
#define IB_SRPT_H
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/wait.h>
|
||||
|
Loading…
Reference in New Issue
Block a user