From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754185AbdJSUpm (ORCPT ); Thu, 19 Oct 2017 16:45:42 -0400 Received: from mout.web.de ([212.227.17.12]:61416 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753212AbdJSUpj (ORCPT ); Thu, 19 Oct 2017 16:45:39 -0400 Subject: Re: char/tpm: Less checks in tpm_ibmvtpm_probe() after error detection To: Dan Carpenter , =?UTF-8?Q?Michal_Such=c3=a1nek?= , linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: Andy Shevchenko , Benjamin Herrenschmidt , Corentin Labbe , Jarkko Sakkinen , Jason Gunthorpe , Jerry Snitselaar , Kenneth Goldman , Michael Ellerman , Nayna Jain , Paul Mackerras , =?UTF-8?Q?Peter_H=c3=bcwe?= , Stefan Berger , kernel-janitors@vger.kernel.org, LKML References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <09a2c3a1-1b10-507d-a866-258b570f6da1@users.sourceforge.net> <20171019135632.4af42743@kitsune.suse.cz> <20171019133646.gu7qv2tywfk4tcxj@mwanda> From: SF Markus Elfring Message-ID: Date: Thu, 19 Oct 2017 22:44:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171019133646.gu7qv2tywfk4tcxj@mwanda> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:D5JJzGDfN2XCd5XWUKtH1KK/yb9f3MARXe1HPvmAzL7+YmCbGNo lAoktU61xkUJixPiVEJjvHtgwGk8ZaJrR//f34XbmKprwkvvFRTBFFrBCe23JXyuYMk9/79 SenjRIUbq+hKtclIHzLnMH37Vz9R7dBzuA4RfkdfHt8tCx6qYf4bNpsU5dcsROQWwWy/BVD J+/xPC1WKUmX4tEEyfOtQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:TaT+U2D2dkE=:lNqc2vrgwycOuVoFGVoMGD 5EtXMVB/aLwUytBZ76hLr0AIbLL0/BAsJT+455BInsQ6+kjVIk8R5KJfIUUQOiBo9gjbWWjHg 1A1NmBIV/U6FCzVUn7y/XrXm3hRpbAcrt27LS+PA3xUSA/Iun5lhXaSXRWQehWAzVhm59zB2W a3Br7ya/f+x2D8UvpHRQ7AO+AWZcp9itURm1Svj9ntUvkVjLucJkH8if2LfTCVLq16e+WGBxQ P7KRwz/hR2V0S0cFDcNVp/Z9zcoLX4ccnhSBzZDRxbmx5R4wxjSNstDADvqH7N4dQLfTwzR/2 rKxtkuvvq52T1IpvUjmuWOIMgWaqhjCwkyPUKdSaxCA3AxNCdHn2oKXorJzcTtbbE+20In/xk TVaP20vNugAhYpzftBiSYvgYwqw1u+WQTfU4dIW0UrdIC2GOhOn+s65cTAVvzVo5G0ykpDwzA iDxrqKv4/7G1Euq5OgZs9J0Efqmb5k9qJNtrLmt8v1FK4asOjIUYiwaw5WfBbQHzpErOj+NRE Ug7y7OVsm/SPo1ZPJH0fhxTwzKR9PvMrYUpBSq3w8p4lGCx6p9jvGO6bwW3tPo8YgLEvC//ZF OFk6gcvA6kCcj0oH4AhxfGzVB5UUBrGwdRyuwWNGyj46HBmCtaE3M8UVBLMOr8N9dRRENoHD5 TFB7rfEeCI9GHVvGKPs2bSYQju2585VE0OTyQ/6M5wSTbxakD0yI2/p/itZWm2+EoCQgxD5Wf 1oTTzXin6r9O16OyM7dUZyzdBcypPs3TeXAGwp3eut2cdokMw/P9XkdjQDVVVyW5FfA6IKF4g aMuwvD4sV2OoRh5uKhYokH8Tc4iyQGiKsUOxq4aA9/gmzNG8nA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> If the code doing the allocation is changed in the future the single >> cleanup can stay whereas multiple labels have to be rewritten again. > > No, they don't unless you choose bad label names. Perhaps numbered > labels? We don't get a lot of those in the kernel any more. Label > name should be based on what the label does. Often I see bad label > names like generic labels: > > foo = kmalloc(); > if (!foo) > goto out; > > What is out going to do? Another common anti-pattern is come-from > labels: > > foo = kmalloc(); > if (!foo) > goto kmalloc_failed; > > Obviously, we can see from the if statement that the alloc failed and > you *just* know the next line is going to be is going to be: > > if (invalid) > goto kmalloc_failed; > > Which is wrong because kmalloc didn't fail... But if the label name is > based on what it does then, when you add or a remove an allocation, you > just have to edit the one thing. Would you be interested in an update on a topic like “Source code review around jump label usage”? https://lkml.org/lkml/2015/12/11/378 Regards, Markus