From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.199 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796079235; b=L4SNHj9v7lNdUN3EraQwWiDK819WuIjadAxfETMVYh8yUw4jPYKvbA9O+p5+9ygYhqtH uNNiq6WRrUzl2NLtzRnXKM0F3KsDfo3A4Q8QPBQNHU2O84qP+HmxNdPrJqRXwrTBTiOSb Dw1rGeU1QtyuogjW3Pa/M60Ev+B5SPpivJwDjQsOMawECPjx1M53JScn36ZNMx7TER9l7 6OTD5e2X8eqAEUjDbfVlyObtYk2J4kjgEpsUP6Spe5VN2wrd9kf1B9Iw3Y6a8ZT09RqjE Z/nGumsWQma4HMHqXC9tHrrbosKaaR8DOcPlkEkGkYqWZofkVrKDEyLVHa7TZoCZ9pA== 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=CVvoEFl0y/WX3TA7H1JVpVY3t3VI2VTtobXDIeZ0SPa5KCJ3c52VJRUJpIlEBOvRQnPr 2TNfMgRmdDlQZ8UfEUl2I8q2J0F1N+khwR3FyeBpLWrLVJTVnHhdCJpN8IzP0zl9V/qh+ 5UbTqT9DBWjqih2pC9eKqSwPF/r4pnZj4b7NSvxSAVsI0QjnmaQJ5JXNmKyXCGfDWQvLv 8HxvilmhkFAD5XUaPDRv/IHg5pEwLooY+DXdIQbQi1sz9jtEDmeNqu9xtO8Xi91Vk6/g6 mGwe/IXhYgoRfHe6JiKW9W7Cz2MvWppx1Vm1G4idvBW6MMc1uN2PiDOXnKADdaPdZ+g== 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=CSLLGGA1; arc=none smtp.remote-ip=74.125.82.199 Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) (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 0CBE2606A31A for ; Mon, 30 Nov 2026 22:53:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0CBE2606A31A 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=CSLLGGA1 Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-386b8624cf7so5333910eec.1 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=lists.linux.dev; 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=CSLLGGA16OVbTFTuoH/GhhOWoKpZtDUOqjZKeLZHlDHbqbQayKn42w8wvl+qmrkyEL Z9/D1T+6Jpoy2Dv9sCDmm+SI494mTZoQDThxFhobbCMIplu4Zd8hz/Ad5OqovhpRRh0Q 4vXtHw6HGAI1X8nCM+trUTAsDWW7TISgJAJaeNS7qjIKauunKColIXmk+SPEcdG8PHYs 41PHwLX0AWqpHvO2YsgomFWxF2IKdOncsKBFJB/nmvv9TK+M1MF/JvqOQjFVr8FpDUgZ fIMIVedOF0Mh506cTxAzgkBEFTc1mwpdo8hzySiw2p3ddn7VSchHj94RdzyKxc1lVsn2 ShIg== 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=x4hpNj/h+qeAJVX+h7ZSzxqAt2mWxsYFHgrcqHMfr9S9+MduTxOpgzGyQGcdloJB8f UQyJAvPNB3hSSXyN1SqQZg9QpvEFxTH2AmpUNwctF+1lrJVmQHipu2DQgtFIuXiMOYPm EQxPPP669Sa1voE4FLbDflCsXgZA/ka+m6mgJQ8rRp971m5R4k3rvaB5Brve9ouujSyn kfh53Pv6TnTnypfw+qRm6vVTL+lm4l4HuvviOcsdcMn58Ul4FOf8KRkq2kFdujKUPvyE WWMpWPhq5bT7/1lPVdL5rlhFB2/rpOjq/VEyyLA8PznBoNBsT9OfmbV4sdO/LjqOrlNN qlKg== X-Forwarded-Encrypted: i=1; AL+hErH3rz+u9S+p4ffJV9Ch5FiTzYwYCM1z4i8VdFfrsQ+wxClMXRnNHEBorZDt+nFRLtIwewDoYIpLpUhmHg==@lists.linux.dev X-Gm-Message-State: APuU4Z8ajd5PyHyziJamER+ufVP/fNxG1lUW1WUuQAE75hmOfCqmwjen gKGYl00YHKYtXGuk4LhtsGO1hupJrqeFuqLYo2+cpchVpOX9KrPc6NGp3ykperPQ3qdjlXMGT64 6s2+iXGiJXg== 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: driver-core@lists.linux.dev 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