public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/3] ib_srpt: checking NULL instead of ERR_PTR
@ 2011-11-04 18:27 Dan Carpenter
       [not found] ` <20111104182732.GH5796-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-11-04 18:27 UTC (permalink / raw)
  To: Roland Dreier
  Cc: Sean Hefty, Hal Rosenstock, Nicholas A. Bellinger,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

transport_init_session() and target_fabric_configfs_init() don't
return NULL pointers, they only return ERR_PTRs or valid pointers.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 937b4bc..f27b8da 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2602,10 +2602,10 @@ 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");
 		goto deregister_session;
 	}
 	ch->sess->se_node_acl = &nacl->nacl;
@@ -4019,10 +4020,10 @@ static int __init srpt_init_module(void)
 	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;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch 2/3] ib_srpt: checking NULL instead of ERR_PTR
       [not found] ` <20111104182732.GH5796-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2011-11-04 21:54   ` Nicholas A. Bellinger
  2012-02-03 13:01     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas A. Bellinger @ 2011-11-04 21:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, target-devel,
	Bart Van Assche

On Fri, 2011-11-04 at 21:27 +0300, Dan Carpenter wrote:
> transport_init_session() and target_fabric_configfs_init() don't
> return NULL pointers, they only return ERR_PTRs or valid pointers.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

Thanks for catching this breakage.  It appears that are a few other
locations outside of ib_srpt where return checking for these two
functions needs to be fixed as well.  I'll fix this up shortly.

Thanks for the review!

--nab

> 
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 937b4bc..f27b8da 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -2602,10 +2602,10 @@ 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");
>  		goto deregister_session;
>  	}
>  	ch->sess->se_node_acl = &nacl->nacl;
> @@ -4019,10 +4020,10 @@ static int __init srpt_init_module(void)
>  	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;
>  	}
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 2/3] ib_srpt: checking NULL instead of ERR_PTR
  2011-11-04 21:54   ` Nicholas A. Bellinger
@ 2012-02-03 13:01     ` Dan Carpenter
       [not found]       ` <CA+_b7DK-=ORJQ20aHE_aVgEud4vAPQG_sskOeMqftabzun0h+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-02-03 13:01 UTC (permalink / raw)
  To: nab
  Cc: Dan Carpenter, Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma, kernel-janitors, target-devel, Bart Van Assche

On 11/5/11, Nicholas A. Bellinger <nab@risingtidesystems.com> wrote:
> On Fri, 2011-11-04 at 21:27 +0300, Dan Carpenter wrote:
>> transport_init_session() and target_fabric_configfs_init() don't
>> return NULL pointers, they only return ERR_PTRs or valid pointers.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Thanks for catching this breakage.  It appears that are a few other
> locations outside of ib_srpt where return checking for these two
> functions needs to be fixed as well.  I'll fix this up shortly.
>

All the others seem to fixed up.  It's just these two place which need
to be fixed still.  My patch still applies fine with a little fuzz.  ;)

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 2/3] ib_srpt: checking NULL instead of ERR_PTR
       [not found]       ` <CA+_b7DK-=ORJQ20aHE_aVgEud4vAPQG_sskOeMqftabzun0h+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-02-03 17:08         ` Roland Dreier
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Dreier @ 2012-02-03 17:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: nab-4mckEHfoRW3KI0RCH6AXYZqQE7yCjDx5, Dan Carpenter, Sean Hefty,
	Hal Rosenstock, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, target-devel,
	Bart Van Assche

On Fri, Feb 3, 2012 at 5:01 AM, Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> All the others seem to fixed up.  It's just these two place which need
> to be fixed still.  My patch still applies fine with a little fuzz.  ;)

I have a few pending srpt patches, coincidentally including one that hits
very near yours leading to a trivial conflict.  So I just merged yours into
your tree as well and I guess I'll send to Linus shortly.

Thanks,
  Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-03 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 18:27 [patch 2/3] ib_srpt: checking NULL instead of ERR_PTR Dan Carpenter
     [not found] ` <20111104182732.GH5796-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2011-11-04 21:54   ` Nicholas A. Bellinger
2012-02-03 13:01     ` Dan Carpenter
     [not found]       ` <CA+_b7DK-=ORJQ20aHE_aVgEud4vAPQG_sskOeMqftabzun0h+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-03 17:08         ` Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox