public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jori Koolstra <jkoolstra@xs4all.nl>
Cc: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	kees@kernel.org, "Dan Williams" <dan.j.williams@intel.com>,
	"Alexey Kardashevskiy" <aik@amd.com>,
	"Jonathan Cameron" <jonathan.cameron@huawei.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Xu Yilun" <yilun.xu@linux.intel.com>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virt: coco: change tsm_class to a const struct
Date: Wed, 4 Mar 2026 10:59:00 +0100	[thread overview]
Message-ID: <2026030423-reanalyze-backshift-4a16@gregkh> (raw)
In-Reply-To: <1298252401.336207.1772616903852@kpc.webmail.kpnmail.nl>

On Wed, Mar 04, 2026 at 10:35:03AM +0100, Jori Koolstra wrote:
> Hi Thomas,
> 
> > Op 04-03-2026 08:12 CET schreef Thomas Weißschuh <thomas.weissschuh@linutronix.de>:
> > 
> > > @@ -114,18 +118,16 @@ static void tsm_release(struct device *dev)
> > >  
> > >  static int __init tsm_init(void)
> > >  {
> > > -	tsm_class = class_create("tsm");
> > > -	if (IS_ERR(tsm_class))
> > > -		return PTR_ERR(tsm_class);
> > > +	int err;
> > >  
> > > -	tsm_class->dev_release = tsm_release;
> > > -	return 0;
> > > +	err = class_register(&tsm_class);
> > > +	return err;
> > 
> > 'err' looks to be unnecessary now.
> > 
> > >  }
> 
> This was what I had before. I thought that returning class_register() immediately,
> even though it saves two lines, might be less readable. You either have to click
> through to class_register() or know that these init functions return an error.
> Is there convention for this?

A single line function of:

static int __init tsm_init(void)
{
	return class_register(&tsm_class);
}

Is just fine.

thanks,

greg k-h

  reply	other threads:[~2026-03-04  9:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 19:05 [PATCH] virt: coco: change tsm_class to a const struct Jori Koolstra
2026-03-04  7:12 ` Thomas Weißschuh
2026-03-04  9:35   ` Jori Koolstra
2026-03-04  9:59     ` Greg Kroah-Hartman [this message]
2026-04-01 17:07   ` Jori Koolstra

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=2026030423-reanalyze-backshift-4a16@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=aik@amd.com \
    --cc=bhelgaas@google.com \
    --cc=dan.j.williams@intel.com \
    --cc=jkoolstra@xs4all.nl \
    --cc=jonathan.cameron@huawei.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=yilun.xu@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox