All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Lino Sanfilippo <LinoSanfilippo@gmx.de>
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 <l.sanfilippo@kunbus.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v6] tpm: fix reference counting for struct tpm_chip
Date: Wed, 24 Feb 2021 18:45:35 +0200	[thread overview]
Message-ID: <YDaCrwnoZZ/b3VmP@kernel.org> (raw)
In-Reply-To: <aa2ec878-f8ea-d28b-c7c2-ecdc3d19f71e@gmx.de>

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
 

      parent reply	other threads:[~2021-02-24 16:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 20:29 [PATCH v6] TPM fixes Lino Sanfilippo
2021-02-18 20:29 ` [PATCH v6] tpm: fix reference counting for struct tpm_chip Lino Sanfilippo
2021-02-19  9:13   ` Jarkko Sakkinen
2021-02-19  9:15     ` Jarkko Sakkinen
2021-02-21 10:19     ` Lino Sanfilippo
2021-02-21 13:25       ` Jarkko Sakkinen
2021-02-24 16:45       ` Jarkko Sakkinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YDaCrwnoZZ/b3VmP@kernel.org \
    --to=jarkko@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=jgg@ziepe.ca \
    --cc=l.sanfilippo@kunbus.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=stable@vger.kernel.org \
    --cc=stefanb@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.