Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1471298

Re: [PATCH 5/8] cris-cryptocop: Move an assignment for the variable "nooutpages" in cryptocop_ioctl_process()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject Re: [PATCH 5/8] cris-cryptocop: Move an assignment for the variable "nooutpages" in cryptocop_ioctl_process()
Date 2016-08-28 09:30 +0200
Message-ID <sb2Hv-77Y-1@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <saoTL-7aM-3@gated-at.bofh.it> <saoTL-7aM-9@gated-at.bofh.it> <saR9n-8pi-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> +++ b/arch/cris/arch-v32/drivers/cryptocop.c
>> @@ -2469,7 +2469,7 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
>>  	struct page                     **inpages = NULL;
>>  	struct page                     **outpages = NULL;
>>  	int                             noinpages = 0;
>> -	int                             nooutpages = 0;
>> +	int                             nooutpages;
>>
>>  	struct cryptocop_desc           descs[5]; /* Max 5 descriptors are needed, there are three transforms that
>>  						   * can get connected/disconnected on different places in the indata. */
>> @@ -2695,6 +2695,8 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
>>  			err = -ENOMEM;
>>  			goto free_inpages;
>>  		}
>> +	} else {
>> +		nooutpages = 0;
> 
> Why is it better?  4 characters have becomes 2 lines.

I suggest to express in a more precise way where this variable is needed actually.

* It would also be an update candidate for the refactoring "Reduce the scope of a variable", wouldn't it?

* Or would the refactoring "Split the implementation of a function into further functions" more appropriate here?

Regards,
Markus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 5/8] cris-cryptocop: Move an assignment for the variable  "nooutpages" in cryptocop_ioctl_process() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
  Re: [PATCH 5/8] cris-cryptocop: Move an assignment for the variable  "nooutpages" in cryptocop_ioctl_process() Julia Lawall <julia.lawall@lip6.fr> - 2016-08-27 21:10 +0200
    Re: [PATCH 5/8] cris-cryptocop: Move an assignment for the variable  "nooutpages" in cryptocop_ioctl_process() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-28 09:30 +0200
      Re: [PATCH 5/8] cris-cryptocop: Move an assignment for the variable  "nooutpages" in cryptocop_ioctl_process() Julia Lawall <julia.lawall@lip6.fr> - 2016-08-28 12:30 +0200

csiph-web