From: Ian Rogers <irogers@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>,
Luis Chamberlain <mcgrof@kernel.org>
Cc: Dave Ertman <david.m.ertman@intel.com>,
Ira Weiny <iweiny@kernel.org>, Leon Romanovsky <leon@kernel.org>,
Kees Cook <kees@kernel.org>, Miguel Ojeda <ojeda@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
driver-core@lists.linux.dev, llvm@lists.linux.dev,
linux-kernel@vger.kernel.org, Ian Rogers <irogers@google.com>
Subject: [PATCH 2/3] driver core: auxiliary: Annotate probe and id_table with __must_init
Date: Mon, 30 Nov 2026 14:53:39 -0800 [thread overview]
Message-ID: <20261130225340.96859-3-irogers@google.com> (raw)
In-Reply-To: <20261130225340.96859-1-irogers@google.com>
__auxiliary_driver_register() rejects auxiliary_driver structures that
omit probe or id_table with WARN_ON(!auxdrv->probe) and
WARN_ON(!auxdrv->id_table), returning -EINVAL.
Annotate probe and id_table in struct auxiliary_driver with __must_init
so missing initializers are caught at compile time.
Signed-off-by: Ian Rogers <irogers@google.com>
---
include/linux/auxiliary_bus.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/auxiliary_bus.h b/include/linux/auxiliary_bus.h
index de0ecd0fb05a..387f2af85526 100644
--- a/include/linux/auxiliary_bus.h
+++ b/include/linux/auxiliary_bus.h
@@ -191,14 +191,15 @@ struct auxiliary_device {
* };
*/
struct auxiliary_driver {
- int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id);
+ int (*probe)(struct auxiliary_device *auxdev,
+ const struct auxiliary_device_id *id) __must_init;
void (*remove)(struct auxiliary_device *auxdev);
void (*shutdown)(struct auxiliary_device *auxdev);
int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state);
int (*resume)(struct auxiliary_device *auxdev);
const char *name;
struct device_driver driver;
- const struct auxiliary_device_id *id_table;
+ const struct auxiliary_device_id *id_table __must_init;
};
static inline void *auxiliary_get_drvdata(struct auxiliary_device *auxdev)
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-30 22:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 22:53 [PATCH 0/3] driver core: Add __must_init annotations to core registration structs Ian Rogers
2026-11-30 22:53 ` [PATCH 1/3] driver core: Require explicit initialization of class and bus_type name Ian Rogers
2026-11-30 22:53 ` Ian Rogers [this message]
2026-11-30 22:53 ` [PATCH 3/3] firmware_loader: Annotate mandatory fw_upload_ops with __must_init Ian Rogers
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=20261130225340.96859-3-irogers@google.com \
--to=irogers@google.com \
--cc=dakr@kernel.org \
--cc=david.m.ertman@intel.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=iweiny@kernel.org \
--cc=johan@kernel.org \
--cc=kees@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mcgrof@kernel.org \
--cc=nathan@kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
/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