Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751688AbbKJEDA (ORCPT ); Mon, 9 Nov 2015 23:03:00 -0500 Received: from mga14.intel.com ([192.55.52.115]:35827 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbbKJEC7 (ORCPT ); Mon, 9 Nov 2015 23:02:59 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,268,1444719600"; d="scan'208";a="815956360" Date: Tue, 10 Nov 2015 06:02:54 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Peter Huewe , Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register() Message-ID: <20151110040254.GA383@intel.com> References: <1446969067-29016-1-git-send-email-jarkko.sakkinen@linux.intel.com> <20151109224720.GD1305@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151109224720.GD1305@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1079 Lines: 33 On Mon, Nov 09, 2015 at 03:47:20PM -0700, Jason Gunthorpe wrote: > On Sun, Nov 08, 2015 at 09:51:07AM +0200, Jarkko Sakkinen wrote: > > + if (rc && rc != -ENOENT) { > > + tpm_chip_unregister(chip); > > + return rc; > > + } > > + } > > This is still goofy looking, the list_add_tail_rcu should be the last > thing done and cannot fail. Just code this with the usual goto based > unwind and goto to do tpm_dev_del_device for the above failure. Agreed that this would be cleaner. > > + > > return 0; > > out_err: > > tpm1_chip_unregister(chip); > > Which avoids calling tpm1_chip_unregister and tpm_chip_unregister in > the same function, which looks so wrong to a casual read.. I'm not going to change the current patch at this point of release cycle but this clean up definitely makes sense later on. > Jason /Jarkko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/