Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751688AbbKIWr2 (ORCPT ); Mon, 9 Nov 2015 17:47:28 -0500 Received: from quartz.orcorp.ca ([184.70.90.242]:50099 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbbKIWr1 (ORCPT ); Mon, 9 Nov 2015 17:47:27 -0500 Date: Mon, 9 Nov 2015 15:47:20 -0700 From: Jason Gunthorpe To: Jarkko Sakkinen 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: <20151109224720.GD1305@obsidianresearch.com> References: <1446969067-29016-1-git-send-email-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446969067-29016-1-git-send-email-jarkko.sakkinen@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.160 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 808 Lines: 25 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. > + > 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.. Jason -- 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/