From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796079235; b=HTn1Ay7ERoT3AzlQQ+CA3Vr30reFX7215JpptD7SRQc/S5k2kMXnFCrOGeyFgiOizW+x Tqg5Xb5IEtJ2FsEjUacVUqx4LH1IXg9j/JsF+4yXfu4zUKpWxke1I1JigbpjMNoYo56Ij 1pxjeVwLY6HbuRxiQ9fRcnUniumeIAb2XwVvGThE9lw6bZqo++HnEejgeiUbGn6kWdhtA uZl33kfF/FUc+Ouage/b173X7UsyyDJYjvG4P7IeU84rtnZs/3xIeAR+/spyrHM81QrtY EQL/98DAt+PMQ6naOLItOtorPxtoAQo/qKTT4APZ45lGpxvSJANuwMr9JQvyMI+eSbA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796079235; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=rwPvNB/5QasjfUpfHwiY5rx2Wsi/Vuu23HenfI36AlQ=; b=uY9rVLZji2CTg3rMMDqKXRvIpVG2ZAWH/n/VsXM2NeE5jNz5UyR8h1Rr6S+h87Jok+gv kr7pkvlSxDtjgWW9N5+Sa898DWIWlkv+4b4TIorVNavE7cPVeEvw9ERvOS/D/XvmICprQ ftE9PsD2rXvjhxsRSwsoLzKlDrLaa/Xv7+AO97C/C7jA4+HbVAsPjW19yki94iWM6QcAe v7j+YRjoBQcWWcLahLv+VjLNYdUANEEgP9G0rqrRWzOIf2Quc7ElmsdkB/zwfGfyy5puk e9FMtp09UotLnk97JUK2D5E07Trt9+wgtDvvOuYtgQ5ToSX81EFJJqn1svRxeeMSIkQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=TMDaKfZt; arc=none smtp.remote-ip=74.125.82.200 Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF1D1606A330 for ; Mon, 30 Nov 2026 22:53:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF1D1606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=TMDaKfZt Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-386ad819860so5659683eec.0 for ; Mon, 30 Nov 2026 14:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796079234; x=1796684034; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rwPvNB/5QasjfUpfHwiY5rx2Wsi/Vuu23HenfI36AlQ=; b=TMDaKfZtYM40aMVaisIfT+uVt1GZO8ZUxpyU09OqzNqdI83B3xpYBOrSEmJNNYPPMe a0TVjvfRfzJpeTASq3wwePk6wSSbyub1bV6gqfPSyGtCmrEES+0NFL32ZMV6/4mQlQyg H0cexsVdQ3LCDwn4W0hCvI8OBA/B+JgLd9OSKNIN4zY8fTzBClvckxAZ/cXs2QuUQf6L +PEFjAl1FLP5y4rc1/Yvptt9dnT3ls89lqWTMC2xRNBPdIuyIbRhMHPOJKdX66FWwLsr nEQziHtFfLwME5qSTnYv6tqp82Z0qlmZTH2upIaej0b9sGsOL3clYBYOhfZSmE7WTcM0 EUbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796079234; x=1796684034; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rwPvNB/5QasjfUpfHwiY5rx2Wsi/Vuu23HenfI36AlQ=; b=KPmMYH5Mf3pnxqtXxvUpo7NR12O9hUmwfEmliOBXnJf53agQmriBJT874uSgSYL0ni 4HFRXDXnAWypwi6Ip6I2uUQja2Peu3S//u2+hTmjkYfLq5SGbhD/DH4YLXh7CXxKosIX TjwMVtiHFMbvu1xK7/xdlG2yzKNAfZ+sia42tbZSJCIdtKTquoXF5Drg4q4VP6gQFElO IE191YEDNGbmKE5gh2WBAmPA74sg7aPR8CK5kBfEfCuDtBO7lYR3SQQypBV7YMjV+qf/ ivcSc2eokaDx/0J4Wpv2K2XHWpeiYeOQxzC1ZzJ+R3rNp5pU1+mfbPIR9iGY69Vx4IkU RAVw== X-Forwarded-Encrypted: i=1; AL+hErHFjxyqSwcTJ2+M61eCO6tPwUo4gzidtLqAPwn8yGOCu8QleTCbq4vu8IteZ5iJNEAMU5k3efhs3lxJ9Kw=@vger.kernel.org X-Gm-Message-State: APuU4Z+FqCsARHtehhIR2Rq1hCLaNV0A5kfWLuG3W/UazDQOywIska0L TJ1K636NUtMUKQkE1rIaFFPDEKyKVPo66B1DvmTRH0l6f/nO/uEAkmhqsNY5y1LHkCw0uP2DQg6 hmogx0haHSw== X-Received: from dycue8.prod.google.com ([2002:a05:7300:88:b0:387:f63:1a9e]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:df48:b0:386:a5d0:15d9 with SMTP id 5a478bee46e88-386a5d018c8mr27644345eec.37.1796079233848; Mon, 30 Nov 2026 14:53:53 -0800 (PST) Date: Mon, 30 Nov 2026 14:53:38 -0800 In-Reply-To: <20261130225340.96859-1-irogers@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261130225340.96859-1-irogers@google.com> X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261130225340.96859-2-irogers@google.com> Subject: [PATCH 1/3] driver core: Require explicit initialization of class and bus_type name From: Ian Rogers To: Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich , Johan Hovold , Luis Chamberlain Cc: Dave Ertman , Ira Weiny , Leon Romanovsky , Kees Cook , Miguel Ojeda , Nathan Chancellor , driver-core@lists.linux.dev, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" class_register() and bus_register() pass .name to kobject_set_name() to register the subsystem kset in sysfs, which fails with -ENOMEM if .name is NULL. Annotate .name on struct class and struct bus_type with __must_init so missing names are caught at compile time. Signed-off-by: Ian Rogers --- include/linux/device/bus.h | 2 +- include/linux/device/class.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index 9ef7538a9a7f..f6409b1004e3 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -79,7 +79,7 @@ struct fwnode_handle; * private data. */ struct bus_type { - const char *name; + const char *name __must_init; const char *dev_name; const struct attribute_group *const *bus_groups; const struct attribute_group *const *dev_groups; diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 9db1d61ba743..032b5dce2e0a 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -48,7 +48,7 @@ struct fwnode_handle; * connected or how they work. */ struct class { - const char *name; + const char *name __must_init; const struct attribute_group *const *class_groups; const struct attribute_group *const *dev_groups; -- 2.56.1.839.g22a8290db9-goog