linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target: fix return value check in sbp_register_configfs()
@ 2012-09-21  5:57 Wei Yongjun
  2012-09-22 23:55 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-09-21  5:57 UTC (permalink / raw)
  To: bootc, nab; +Cc: yongjun_wei, linux-scsi, target-devel, linux1394-devel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function target_fabric_configfs_init() returns
ERR_PTR() not NULL pointer. The NULL test in the return value check
should be replaced with IS_ERR().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/target/sbp/sbp_target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 39ddba5..773303e 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -2556,9 +2556,9 @@ static int sbp_register_configfs(void)
 	int ret;
 
 	fabric = target_fabric_configfs_init(THIS_MODULE, "sbp");
-	if (!fabric) {
+	if (IS_ERR(fabric)) {
 		pr_err("target_fabric_configfs_init() failed\n");
-		return -ENOMEM;
+		return PTR_ERR(fabric);
 	}
 
 	fabric->tf_ops = sbp_ops;

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

* Re: [PATCH] target: fix return value check in sbp_register_configfs()
  2012-09-21  5:57 [PATCH] target: fix return value check in sbp_register_configfs() Wei Yongjun
@ 2012-09-22 23:55 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2012-09-22 23:55 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: bootc, yongjun_wei, linux-scsi, target-devel, linux1394-devel

On Fri, 2012-09-21 at 13:57 +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function target_fabric_configfs_init() returns
> ERR_PTR() not NULL pointer. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> dpatch engine is used to auto generated this patch.
> (https://github.com/weiyj/dpatch)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/target/sbp/sbp_target.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
> index 39ddba5..773303e 100644
> --- a/drivers/target/sbp/sbp_target.c
> +++ b/drivers/target/sbp/sbp_target.c
> @@ -2556,9 +2556,9 @@ static int sbp_register_configfs(void)
>  	int ret;
>  
>  	fabric = target_fabric_configfs_init(THIS_MODULE, "sbp");
> -	if (!fabric) {
> +	if (IS_ERR(fabric)) {
>  		pr_err("target_fabric_configfs_init() failed\n");
> -		return -ENOMEM;
> +		return PTR_ERR(fabric);
>  	}
>  
>  	fabric->tf_ops = sbp_ops;
> 
> 

Good catch.  Applied to target-pending/for-next for the v3.7-rc1
target-updates PULL.

Thanks Wei !

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

end of thread, other threads:[~2012-09-22 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21  5:57 [PATCH] target: fix return value check in sbp_register_configfs() Wei Yongjun
2012-09-22 23:55 ` 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;
as well as URLs for NNTP newsgroup(s).