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


Groups > linux.kernel > #1563914

Re: powerpc/nvram: Move an assignment for the variable "ret" in dev_nvram_write()

From Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: powerpc/nvram: Move an assignment for the variable "ret" in dev_nvram_write()
Date 2017-01-20 22:00 +0100
Message-ID <t1OrT-3C9-17@gated-at.bofh.it> (permalink)
References <t1oe5-40V-3@gated-at.bofh.it> <t1onM-4jH-29@gated-at.bofh.it> <t1vfA-8d-7@gated-at.bofh.it> <t1BuF-4cQ-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/19/2017 11:08 PM, SF Markus Elfring wrote:
>> I think you really could have squashed patches 1-3 into a single patch
>> that returns directly after any failure.
> 
> Thanks for your constructive feedback.
> 
> I have got software development concerns around such patch squashing.
> 
> 
>> At this point you might as well remove that label and move the kfree(tmp) call up
>> and return directly after the failure and at the nvram_write() call site
>> doing away completely with the "ret" variable.
> 
> Your idea might look nice at first glance. But I would interpret the previous
> implementation of the discussed function in the way that the memory which was
> dynamically allocated here should always (not only in the failure case) be released
> before returning here.

You are correct. I did muck that part up. However, I do still believe it
is cleaner to squash your three patches together. There is no functional
change here and it is clearer in a single patch that you are modifying
the function to return directly in the simple error cases.

-Tyrel

> 
> Would you really like to change the life time for this “temporary” data item?
> 
> Regards,
> Markus
> 

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


Thread

[PATCH 0/8] PowerPC-NVRAM: Fine-tuning for some function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 18:00 +0100
  [PATCH 7/8] powerpc/nvram: Improve size determinations in three  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 18:10 +0100
  [PATCH 3/8] powerpc/nvram: Move an assignment for the variable "ret"  in dev_nvram_write() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 18:10 +0100
    Re: [PATCH 3/8] powerpc/nvram: Move an assignment for the variable  "ret" in dev_nvram_write() Tyrel Datwyler <tyreld@linux.vnet.ibm.com> - 2017-01-20 01:30 +0100
      Re: powerpc/nvram: Move an assignment for the variable "ret" in  dev_nvram_write() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-20 08:10 +0100
        Re: powerpc/nvram: Move an assignment for the variable "ret" in  dev_nvram_write() Tyrel Datwyler <tyreld@linux.vnet.ibm.com> - 2017-01-20 22:00 +0100
  [PATCH 6/8] powerpc/nvram: Delete three error messages for a failed  memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 18:10 +0100
  [PATCH 8/8] powerpc/nvram: Move an assignment for the variable "err"  in nvram_scan_partitions() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 18:40 +0100
  [PATCH 5/8] powerpc/nvram: Return directly after a failed kmalloc()  in dev_nvram_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 21:50 +0100

csiph-web