From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D4892FE056 for ; Wed, 4 Mar 2026 09:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772618354; cv=none; b=fbO31IP8QnumxHhoesLKsqrFvrKDNmF6/4PM6NzF1hOGwFcIWLfGenlbgIxPUgkpJshLZ9QKnLm+djMqkGJrqEN7kWX07V7+oEZwGOfxiw+mzDJab/GoE54wi8ZxwntGLDv8dO8JXnnFbTZzdVm2zadOcxAMHcKwAjS6DsYk+kE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772618354; c=relaxed/simple; bh=8wT9O5+/tZ6+cSDxfDQZSnlSyzeiVIvJh6hVywDhIH8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NE5XXkAtLU2PMjLefbxqdMnpAoRcqvJFwEI+CjzyvLD7YBdECZauQ0pTeR4/2YAp+GaCfpHg8KikvMz5j2L2GjgXDQJ/lhFLWYwG4lmmAkZxTLxWxujCkdfef9iffDckd6iifhCnoAwAJB2pEwJXSm4g3tJyLU+ehHQo48QECQs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Zt3APQnl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Zt3APQnl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11ECEC2BCB0; Wed, 4 Mar 2026 09:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1772618353; bh=8wT9O5+/tZ6+cSDxfDQZSnlSyzeiVIvJh6hVywDhIH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zt3APQnlN2wDliVrLjAN/Ve+K1HTZHo2YE8QtjcIbup4x6v0EXmV8PXY7P88obXHS 4oYs7bIEkyBtjLjFaWzDHy/IqBVkWlNK5DLZzvJ6ASwxkDgAfVEWN5vGze5GhU+mf8 0zkBs/Uove7aavXh5QjUToq/ZKI3MJ2BkDi56m1E= Date: Wed, 4 Mar 2026 10:59:00 +0100 From: Greg Kroah-Hartman To: Jori Koolstra Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , kees@kernel.org, Dan Williams , Alexey Kardashevskiy , Jonathan Cameron , Bjorn Helgaas , Xu Yilun , open list Subject: Re: [PATCH] virt: coco: change tsm_class to a const struct Message-ID: <2026030423-reanalyze-backshift-4a16@gregkh> References: <20260303190602.3842367-1-jkoolstra@xs4all.nl> <20260304081137-5246323a-8f5e-4c82-90a1-9499cf223545@linutronix.de> <1298252401.336207.1772616903852@kpc.webmail.kpnmail.nl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 : > > > > > @@ -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