Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp28546pxb; Wed, 24 Feb 2021 17:11:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVqB2pYb5rG4ZJzbgCGcOmuCmlfy8N7w50vLiIy8/FXQnfbbVvFWIljJlgNMunNmnIv3EC X-Received: by 2002:a17:906:32c5:: with SMTP id k5mr315891ejk.249.1614215503426; Wed, 24 Feb 2021 17:11:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614215503; cv=none; d=google.com; s=arc-20160816; b=r4lHqlKdlNFI6igcnJqxt/N1x+HcDMwLK0AKIp+b8NPFFG4PCUeASuOZLaSEpqV3JM T1rgeYorfw/LdKvDx5OSq+wMwUD3DVbByuusl8PbGrSXxNtS3DzXb2y5M33qP0xHsRf6 6AUMVGl9+SRi6qV/STYStmKFKWsn8v5UDluc0uykk0WVitLQ/dl4Y4nGxVhShNJLUx5H 5orCNhGAtKRWNDn3QYM1hlF3rtkXQKYRwII2BeJC1Top+OoQ2tVMOCyx7VseF8i0s8nL Sxh4JTBniO9bo5i65eARXm12O4MVuKNr4IPUDta7/sE4E35jBO05Gk81F1f8VetAEw1+ Y9xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZjveW9frDTUNm6tFaywlbPXa0S+E6huFJE4i+IhR15U=; b=H/qxlPkkdPEZnsiglj4AaUy6PcsF7wbVfl4HcU4RwcSQRjS1UsqZo5WOV9+PPE52Um EVyJ5mls3cyKwStdbm3rnWGBDt4lAYRaKOD6LHuY9ms0jwtRTPHJBr5LLw7fkeYmE//S 9x1Z2jry9linfqPb8hBd2D3AAeNvh/0UMA6Vn07Y0b0YsDuGwR2aAAwYViZbMoavR0hg Vc2G2bK0uYL2CN5JBOjg1EEphQln4XhEvf3NRFQ/YTEWx9wwLJrSooKB8EaU4Q9FXDg1 CuHRN7EZvUEnnlFm04Nj0XxoZEtP+cDUdB7StnQd/oIABQDdBCz51lg3M2v7sy5AD2j4 w1FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uw5dkrtF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si2400276ejy.232.2021.02.24.17.11.18; Wed, 24 Feb 2021 17:11:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uw5dkrtF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235351AbhBXQqm (ORCPT + 99 others); Wed, 24 Feb 2021 11:46:42 -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-kernel@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