From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C5BCC433E0 for ; Wed, 24 Feb 2021 16:46:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6C0264F07 for ; Wed, 24 Feb 2021 16:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233826AbhBXQqk (ORCPT ); Wed, 24 Feb 2021 11:46:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:37214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235301AbhBXQqf (ORCPT ); Wed, 24 Feb 2021 11:46:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A330764F04; Wed, 24 Feb 2021 16:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614185153; bh=Isqqlscrz8r/lMK8N8O5Ru369KorfLi3sBZm8ZIdTlM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uw5dkrtFZ0jP4jQ4UNoVqvYgqsLrjo30okxdOq7fWhz1aMR7uF0zb7tsKp6PC3+x/ BAJPAr0RkoYSyNkEDndnF2UM8nWIkDqFAO+lEyUjR6zpqlFFCeRLJqB7COteNjrFI7 K5btcsHbhXdlmZJZ503MG79jJrr0dJU5/3L3XjTVj3tWi0ZJVAqAWR6JSB5fTQxvKz 10zmqfEOuioJqdVkN6s+KGil6+LnfsIdIAF3L81tg/LpGOIrzLciXf3mS8CF/fOzMX NizMxtt0qKpHBS0OjLJG2Eks3gUp+Qs3r2llf82ObiE3lCGafa0ae/bC0xaSuShFz/ bFFMdnA4wp/VA== Date: Wed, 24 Feb 2021 18:45:35 +0200 From: Jarkko Sakkinen To: Lino Sanfilippo Cc: peterhuewe@gmx.de, jgg@ziepe.ca, stefanb@linux.vnet.ibm.com, James.Bottomley@hansenpartnership.com, David.Laight@aculab.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Lino Sanfilippo , stable@vger.kernel.org Subject: Re: [PATCH v6] tpm: fix reference counting for struct tpm_chip Message-ID: References: <1613680181-31920-1-git-send-email-LinoSanfilippo@gmx.de> <1613680181-31920-2-git-send-email-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Sun, Feb 21, 2021 at 11:19:28AM +0100, Lino Sanfilippo wrote: > > Hi, > > On 19.02.21 at 10:13, Jarkko Sakkinen wrote: > > >> + rc = cdev_device_add(&chip->cdevs, &chip->devs); > >> + if (rc) { > >> + dev_err(&chip->devs, > >> + "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n", > >> + dev_name(&chip->devs), MAJOR(chip->devs.devt), > >> + MINOR(chip->devs.devt), rc); > >> + goto out_put_devs; > >> + } > >> + > >> + return 0; > >> + > >> +out_put_devs: > > > > A nit: > > > > 1. You have already del_cdev: > > 2. Here you use a differing convention with out prefix. > > > > I'd suggest that you put err_ to both: > > > > 1. err_del_cdev > > 2. err_put_devs > > > > It's quite coherent what we have already: > > > > linux-tpmdd on  next took 8s > > ❯ git grep "^err_.*" drivers/char/tpm/ | wc -l > > 17 > > > > > The label del_cdev is indeed a bit inconsistent with the rest of the code. > But AFAICS out_put_devs is not: > 1. all labels in tpm2-space.c start with out_ > 2. there are more hits for out_ across the whole TPM code (i.e. with the same command > you used above I get 31 hits for _out) than for err_. > > I suggest to rename del_cdev to something like out_del_cdev or maybe out_cdev which > seems to be even closer to the existing naming scheme for labels. Generally, I'd prefer the following pattern: out: /* out for success path if needed */ return 0; err_foo: err_bar: return ret; Existing naming scheme is not something to hang into, and I don't care to preserve it. > Regards, > Lino /Jarkko