From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753019AbdJSMq7 (ORCPT ); Thu, 19 Oct 2017 08:46:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:60273 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752835AbdJSMq6 (ORCPT ); Thu, 19 Oct 2017 08:46:58 -0400 Date: Thu, 19 Oct 2017 14:46:55 +0200 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= To: SF Markus Elfring Cc: linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org, Stefan Berger , Nayna Jain , Jerry Snitselaar , LKML , Jarkko Sakkinen , Jason Gunthorpe , Corentin Labbe , Kenneth Goldman , Paul Mackerras , Peter =?UTF-8?B?SMO8d2U=?= , Andy Shevchenko Subject: Re: [PATCH 4/4] char/tpm: Less checks in tpm_ibmvtpm_probe() after error detection Message-ID: <20171019144655.7d06111c@kitsune.suse.cz> In-Reply-To: <9327cc83-448e-8404-af00-73f6409e269e@users.sourceforge.net> References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <09a2c3a1-1b10-507d-a866-258b570f6da1@users.sourceforge.net> <20171019135632.4af42743@kitsune.suse.cz> <9327cc83-448e-8404-af00-73f6409e269e@users.sourceforge.net> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Oct 2017 14:36:09 +0200 SF Markus Elfring wrote: > >> @@ -683,13 +683,10 @@ static int tpm_ibmvtpm_probe(struct vio_dev > >> *vio_dev, reg_crq_cleanup: > >> dma_unmap_single(dev, ibmvtpm->crq_dma_handle, > >> CRQ_RES_BUF_SIZE, DMA_BIDIRECTIONAL); > >> -cleanup: > >> - if (ibmvtpm) { > >> - if (crq_q->crq_addr) > >> - free_page((unsigned long)crq_q->crq_addr); > >> - kfree(ibmvtpm); > >> - } > >> - > > > > I think a single cleanup section is better than many labels that > > just avoid a single null check. > > I proposed to delete two unnecessary condition checks together with > an adjustment of jump targets. > They are necessary to ensure the code works with single jump target. The compiler is free to optimize them away and create the new jump target implicitly. Do not do the optimization in place of the compiler. It can do it automatically, in most cases better, and automatically adapt it to code changes. Thanks Michal