All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-log: fix return value in create_log_context function
@ 2008-12-04  1:15 Takahiro Yasui
  2008-12-18 17:43 ` Takahiro Yasui
  0 siblings, 1 reply; 5+ messages in thread
From: Takahiro Yasui @ 2008-12-04  1:15 UTC (permalink / raw)
  To: device-mapper development

Hi,

This is very trivial fix, but let me post it to improve code
readability. In the current implementation, caller function
does not use the return value and no action is changed.

Regards,
---
Takahiro Yasui
Hitachi Computer Products (America) Inc.



When dm_io_client_create function fails in create_log_context
function, return value is set to variable r but it is not used.
r should be returned.


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 drivers/md/dm-log.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.28-rc7/drivers/md/dm-log.c
===================================================================
--- linux-2.6.28-rc7.orig/drivers/md/dm-log.c
+++ linux-2.6.28-rc7/drivers/md/dm-log.c
@@ -461,7 +461,7 @@ static int create_log_context(struct dm_
 			r = PTR_ERR(lc->io_req.client);
 			DMWARN("couldn't allocate disk io client");
 			kfree(lc);
-			return -ENOMEM;
+			return r;
 		}
 
 		lc->disk_header = vmalloc(buf_size);

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

* Re: [PATCH] dm-log: fix return value in create_log_context function
  2008-12-04  1:15 [PATCH] dm-log: fix return value in create_log_context function Takahiro Yasui
@ 2008-12-18 17:43 ` Takahiro Yasui
  2008-12-18 18:57   ` Jonathan Brassow
  0 siblings, 1 reply; 5+ messages in thread
From: Takahiro Yasui @ 2008-12-18 17:43 UTC (permalink / raw)
  To: device-mapper development

Hi all,

What do you think about this patch? 

> DMWARN("couldn't allocate disk io client"); 

This message is not necessarily related to ENOMEM and returning
variable "r" is better than doing -ENOMEM in terms of function
encapsulation.

I appreciate any comments.

Regards,
Taka


> Hi,
> 
> This is very trivial fix, but let me post it to improve code
> readability. In the current implementation, caller function
> does not use the return value and no action is changed.
> 
> Regards,
> ---
> Takahiro Yasui
> Hitachi Computer Products (America) Inc.
> 
> 
> 
> When dm_io_client_create function fails in create_log_context
> function, return value is set to variable r but it is not used.
> r should be returned.
> 
> 
> Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
> ---
>  drivers/md/dm-log.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6.28-rc7/drivers/md/dm-log.c
> ===================================================================
> --- linux-2.6.28-rc7.orig/drivers/md/dm-log.c
> +++ linux-2.6.28-rc7/drivers/md/dm-log.c
> @@ -461,7 +461,7 @@ static int create_log_context(struct dm_
>  			r = PTR_ERR(lc->io_req.client);
>  			DMWARN("couldn't allocate disk io client");
>  			kfree(lc);
> -			return -ENOMEM;
> +			return r;
>  		}
>  
>  		lc->disk_header = vmalloc(buf_size);
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

* Re: [PATCH] dm-log: fix return value in create_log_context function
  2008-12-18 17:43 ` Takahiro Yasui
@ 2008-12-18 18:57   ` Jonathan Brassow
  2008-12-18 21:23     ` Takahiro Yasui
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Brassow @ 2008-12-18 18:57 UTC (permalink / raw)
  To: device-mapper development

We might also want to change the message in that case then too,  
right?  Maybe "Unable to create disk io client"?

  brassow

On Dec 18, 2008, at 11:43 AM, Takahiro Yasui wrote:

> Hi all,
>
> What do you think about this patch?
>
>> DMWARN("couldn't allocate disk io client");
>
> This message is not necessarily related to ENOMEM and returning
> variable "r" is better than doing -ENOMEM in terms of function
> encapsulation.
>
> I appreciate any comments.
>
> Regards,
> Taka
>
>
>> Hi,
>>
>> This is very trivial fix, but let me post it to improve code
>> readability. In the current implementation, caller function
>> does not use the return value and no action is changed.
>>
>> Regards,
>> ---
>> Takahiro Yasui
>> Hitachi Computer Products (America) Inc.
>>
>>
>>
>> When dm_io_client_create function fails in create_log_context
>> function, return value is set to variable r but it is not used.
>> r should be returned.
>>
>>
>> Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
>> ---
>> drivers/md/dm-log.c |    2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Index: linux-2.6.28-rc7/drivers/md/dm-log.c
>> ===================================================================
>> --- linux-2.6.28-rc7.orig/drivers/md/dm-log.c
>> +++ linux-2.6.28-rc7/drivers/md/dm-log.c
>> @@ -461,7 +461,7 @@ static int create_log_context(struct dm_
>> 			r = PTR_ERR(lc->io_req.client);
>> 			DMWARN("couldn't allocate disk io client");
>> 			kfree(lc);
>> -			return -ENOMEM;
>> +			return r;
>> 		}
>>
>> 		lc->disk_header = vmalloc(buf_size);
>>
>> --
>> dm-devel mailing list
>> dm-devel@redhat.com
>> https://www.redhat.com/mailman/listinfo/dm-devel
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

* Re: [PATCH] dm-log: fix return value in create_log_context function
  2008-12-18 18:57   ` Jonathan Brassow
@ 2008-12-18 21:23     ` Takahiro Yasui
  2009-01-08 15:39       ` Jonathan Brassow
  0 siblings, 1 reply; 5+ messages in thread
From: Takahiro Yasui @ 2008-12-18 21:23 UTC (permalink / raw)
  To: device-mapper development

Hi Jon,

Thanks for reviewing this patch.

> We might also want to change the message in that case then too,  
> right?  Maybe "Unable to create disk io client"?

Thanks, "create disk io client" is better. But I changed as
"couldn't create disk io client" for consistency with other
messages.

Regards,
---
Takahiro Yasui
Hitachi Computer Products (America) Inc.



When dm_io_client_create function fails in create_log_context function,
return value is set to r but it is not used. r should be returned.
In addition, the warning message is properly corrected so that it doesn't
indicate memory allocation.


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 drivers/md/dm-log.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.28-rc8/drivers/md/dm-log.c
===================================================================
--- linux-2.6.28-rc8.orig/drivers/md/dm-log.c
+++ linux-2.6.28-rc8/drivers/md/dm-log.c
@@ -459,9 +459,9 @@ static int create_log_context(struct dm_
 								   PAGE_SIZE));
 		if (IS_ERR(lc->io_req.client)) {
 			r = PTR_ERR(lc->io_req.client);
-			DMWARN("couldn't allocate disk io client");
+			DMWARN("couldn't create disk io client");
 			kfree(lc);
-			return -ENOMEM;
+			return r;
 		}
 
 		lc->disk_header = vmalloc(buf_size);

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

* Re: [PATCH] dm-log: fix return value in create_log_context function
  2008-12-18 21:23     ` Takahiro Yasui
@ 2009-01-08 15:39       ` Jonathan Brassow
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Brassow @ 2009-01-08 15:39 UTC (permalink / raw)
  To: device-mapper development

ACK.

  brassow

On Dec 18, 2008, at 3:23 PM, Takahiro Yasui wrote:

> Hi Jon,
>
> Thanks for reviewing this patch.
>
>> We might also want to change the message in that case then too,
>> right?  Maybe "Unable to create disk io client"?
>
> Thanks, "create disk io client" is better. But I changed as
> "couldn't create disk io client" for consistency with other
> messages.
>
> Regards,
> ---
> Takahiro Yasui
> Hitachi Computer Products (America) Inc.
>
>
>
> When dm_io_client_create function fails in create_log_context  
> function,
> return value is set to r but it is not used. r should be returned.
> In addition, the warning message is properly corrected so that it  
> doesn't
> indicate memory allocation.
>
>
> Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
> ---
> drivers/md/dm-log.c |    4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-2.6.28-rc8/drivers/md/dm-log.c
> ===================================================================
> --- linux-2.6.28-rc8.orig/drivers/md/dm-log.c
> +++ linux-2.6.28-rc8/drivers/md/dm-log.c
> @@ -459,9 +459,9 @@ static int create_log_context(struct dm_
> 								   PAGE_SIZE));
> 		if (IS_ERR(lc->io_req.client)) {
> 			r = PTR_ERR(lc->io_req.client);
> -			DMWARN("couldn't allocate disk io client");
> +			DMWARN("couldn't create disk io client");
> 			kfree(lc);
> -			return -ENOMEM;
> +			return r;
> 		}
>
> 		lc->disk_header = vmalloc(buf_size);
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

end of thread, other threads:[~2009-01-08 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04  1:15 [PATCH] dm-log: fix return value in create_log_context function Takahiro Yasui
2008-12-18 17:43 ` Takahiro Yasui
2008-12-18 18:57   ` Jonathan Brassow
2008-12-18 21:23     ` Takahiro Yasui
2009-01-08 15:39       ` Jonathan Brassow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.