From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753991AbdATUxT (ORCPT ); Fri, 20 Jan 2017 15:53:19 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58585 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753925AbdATUww (ORCPT ); Fri, 20 Jan 2017 15:52:52 -0500 Subject: Re: powerpc/nvram: Move an assignment for the variable "ret" in dev_nvram_write() To: SF Markus Elfring , linuxppc-dev@lists.ozlabs.org References: <53545d97-6ed5-ff17-384f-82e72b3592f9@users.sourceforge.net> <52f46c9b-e049-7288-2c53-9c2525cd84c6@linux.vnet.ibm.com> Cc: Paul Gortmaker , kernel-janitors@vger.kernel.org, LKML , Geliang Tang , Paul Mackerras , Pan Xinhui , Nathan Fontenot , Daniel Axtens From: Tyrel Datwyler Date: Fri, 20 Jan 2017 12:52:44 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17012020-0004-0000-0000-00001159695D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006468; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000200; SDB=6.00810436; UDB=6.00394923; IPR=6.00587789; BA=6.00005080; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013991; XFM=3.00000011; UTC=2017-01-20 20:52:49 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17012020-0005-0000-0000-00007C59C756 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-20_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701200268 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >