public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 3/3] ib_srpt: propagate return value from kstrtoul()
@ 2011-11-04 18:28 Dan Carpenter
  2011-11-04 21:56 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-11-04 18:28 UTC (permalink / raw)
  To: Roland Dreier
  Cc: Sean Hefty, Hal Rosenstock, Nicholas A. Bellinger,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

These days we've renamed strict_strtoul() to kstrtoul().  It has a
couple different error codes it could return.  Smatch complains if
we return -EINVAL instead of using the return value that kstrtoul()
gave us.

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 f27b8da..04ccc04 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3704,10 +3704,10 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size(
 	unsigned long val;
 	int ret;
 
-	ret = strict_strtoul(page, 0, &val);
+	ret = kstrtoul(page, 0, &val);
 	if (ret < 0) {
-		pr_err("strict_strtoul() failed with ret: %d\n", ret);
-		return -EINVAL;
+		pr_err("kstrtoul() failed with ret: %d\n", ret);
+		return ret;
 	}
 	if (val > MAX_SRPT_RDMA_SIZE) {
 		pr_err("val: %lu exceeds MAX_SRPT_RDMA_SIZE: %d\n", val,
@@ -3744,10 +3744,10 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size(
 	unsigned long val;
 	int ret;
 
-	ret = strict_strtoul(page, 0, &val);
+	ret = kstrtoul(page, 0, &val);
 	if (ret < 0) {
-		pr_err("strict_strtoul() failed with ret: %d\n", ret);
-		return -EINVAL;
+		pr_err("kstrtoul() failed with ret: %d\n", ret);
+		return ret;
 	}
 	if (val > MAX_SRPT_RSP_SIZE) {
 		pr_err("val: %lu exceeds MAX_SRPT_RSP_SIZE: %d\n", val,
@@ -3784,10 +3784,10 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size(
 	unsigned long val;
 	int ret;
 
-	ret = strict_strtoul(page, 0, &val);
+	ret = kstrtoul(page, 0, &val);
 	if (ret < 0) {
-		pr_err("strict_strtoul() failed with ret: %d\n", ret);
-		return -EINVAL;
+		pr_err("kstrtoul() failed with ret: %d\n", ret);
+		return ret;
 	}
 	if (val > MAX_SRPT_SRQ_SIZE) {
 		pr_err("val: %lu exceeds MAX_SRPT_SRQ_SIZE: %d\n", val,
@@ -3831,10 +3831,10 @@ static ssize_t srpt_tpg_store_enable(
 	unsigned long tmp;
         int ret;
 
-	ret = strict_strtoul(page, 0, &tmp);
+	ret = kstrtoul(page, 0, &tmp);
 	if (ret < 0) {
 		printk(KERN_ERR "Unable to extract srpt_tpg_store_enable\n");
-		return -EINVAL;
+		return ret;
 	}
 
 	if ((tmp != 0) && (tmp != 1)) {
--
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] 2+ messages in thread

* Re: [patch 3/3] ib_srpt: propagate return value from kstrtoul()
  2011-11-04 18:28 [patch 3/3] ib_srpt: propagate return value from kstrtoul() Dan Carpenter
@ 2011-11-04 21:56 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2011-11-04 21:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma,
	kernel-janitors, target-devel, Bart Van Assche

On Fri, 2011-11-04 at 21:28 +0300, Dan Carpenter wrote:
> These days we've renamed strict_strtoul() to kstrtoul().  It has a
> couple different error codes it could return.  Smatch complains if
> we return -EINVAL instead of using the return value that kstrtoul()
> gave us.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Looks fine to me, and will get this series queued up for -rc2.

Thanks Dan!

--nab

> 
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index f27b8da..04ccc04 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -3704,10 +3704,10 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size(
>  	unsigned long val;
>  	int ret;
>  
> -	ret = strict_strtoul(page, 0, &val);
> +	ret = kstrtoul(page, 0, &val);
>  	if (ret < 0) {
> -		pr_err("strict_strtoul() failed with ret: %d\n", ret);
> -		return -EINVAL;
> +		pr_err("kstrtoul() failed with ret: %d\n", ret);
> +		return ret;
>  	}
>  	if (val > MAX_SRPT_RDMA_SIZE) {
>  		pr_err("val: %lu exceeds MAX_SRPT_RDMA_SIZE: %d\n", val,
> @@ -3744,10 +3744,10 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size(
>  	unsigned long val;
>  	int ret;
>  
> -	ret = strict_strtoul(page, 0, &val);
> +	ret = kstrtoul(page, 0, &val);
>  	if (ret < 0) {
> -		pr_err("strict_strtoul() failed with ret: %d\n", ret);
> -		return -EINVAL;
> +		pr_err("kstrtoul() failed with ret: %d\n", ret);
> +		return ret;
>  	}
>  	if (val > MAX_SRPT_RSP_SIZE) {
>  		pr_err("val: %lu exceeds MAX_SRPT_RSP_SIZE: %d\n", val,
> @@ -3784,10 +3784,10 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size(
>  	unsigned long val;
>  	int ret;
>  
> -	ret = strict_strtoul(page, 0, &val);
> +	ret = kstrtoul(page, 0, &val);
>  	if (ret < 0) {
> -		pr_err("strict_strtoul() failed with ret: %d\n", ret);
> -		return -EINVAL;
> +		pr_err("kstrtoul() failed with ret: %d\n", ret);
> +		return ret;
>  	}
>  	if (val > MAX_SRPT_SRQ_SIZE) {
>  		pr_err("val: %lu exceeds MAX_SRPT_SRQ_SIZE: %d\n", val,
> @@ -3831,10 +3831,10 @@ static ssize_t srpt_tpg_store_enable(
>  	unsigned long tmp;
>          int ret;
>  
> -	ret = strict_strtoul(page, 0, &tmp);
> +	ret = kstrtoul(page, 0, &tmp);
>  	if (ret < 0) {
>  		printk(KERN_ERR "Unable to extract srpt_tpg_store_enable\n");
> -		return -EINVAL;
> +		return ret;
>  	}
>  
>  	if ((tmp != 0) && (tmp != 1)) {

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

end of thread, other threads:[~2011-11-04 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 18:28 [patch 3/3] ib_srpt: propagate return value from kstrtoul() Dan Carpenter
2011-11-04 21:56 ` Nicholas A. Bellinger

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