All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	"moderated list:TPM DEVICE DRIVER" 
	<tpmdd-devel@lists.sourceforge.net>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register()
Date: Tue, 10 Nov 2015 06:02:54 +0200	[thread overview]
Message-ID: <20151110040254.GA383@intel.com> (raw)
In-Reply-To: <20151109224720.GD1305@obsidianresearch.com>

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

  reply	other threads:[~2015-11-10  4:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-08  7:51 [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register() Jarkko Sakkinen
2015-11-09 22:47 ` Jason Gunthorpe
2015-11-10  4:02   ` Jarkko Sakkinen [this message]
2015-11-10  6:11 ` Jeremiah Mahler
2015-11-10  6:16   ` Jarkko Sakkinen

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=20151110040254.GA383@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /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.