From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.197 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796079235; b=Nfju33FuucwplLSR3ZxWnJBaSgo2RhriQ/wczf+ot01UEsJZego1sMDOKTygfdnXGA80 5ggu6uZnGlY9VM9ki3kYKmMuxYgDNIv0BhbIar8vsSLxH7cgjqSTO1lyn98MPNJGFmI73 MVXLcjS+/IeURt9I+lwgc196Ul35oFMEYPtO2+ZLRcVbWLKc8oWkw0QhcX0pRQAuUj3xO TcCCwFx34QpieN5608wk3UprEQ9ix0tFpXYs9/96zXP+tqoi7HjNpSb8/YWOW1K3o3Gfh R5Vkn+umG5wRJ42VUAVAyHEKODZtznkTbIFvW8m06ALv6ssJfPlsqe5MG7X1Om54TEQ== 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=M2PGYp74AHXQOCKwbQGMOHuBRgD/OgHHqjDAVPa54KDGegTxl5QBTLU5ShlzG6viY+vo NraplKK7Cm9nmtUQBAhQJm8W3a5C6vjlpNCSVRit8x7upK3h6ypdf7JTXQvnOiBaqsx3V sR0koaaGWBnO9R+MyXpx76dlkmGaaLP0U0b4RPpPFNwix42bU/FpdlFA+LkPg2bPQuJrn +yAknkyKgAI9ofdIgNjaEmpN0Sc/VYUz71r62CmmcCtRtmjKbnco4EXTY8sL39oDwApwO JNoT5gBXPjUnWxE1TwDoF/lFndam+ylukClI0xAYS4JgjlA9ORv9dwVk1k0WzdWRQFQ== 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.197 Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) (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 11CFC606A332 for ; Mon, 30 Nov 2026 22:53:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 11CFC606A332 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-f197.google.com with SMTP id 5a478bee46e88-386ad819860so5659690eec.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=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=R4Y3tsoDecCF7me45rHCQnHo9bcziI1k49ulKnjkBbRQgN/uyG8cX0Z0hdBTORaapP EAl7u4MAoL4PF5f7tJn0cT7ItZRAVWHauJ2Cp79P0idALn3peNGJnz8Q+inERwoAKYWS nDTgndAoPrGUqkrVYnjCAJrVO1hi8AT87eC/UHKHpU+7L9i0o98bTe77arwjzMFJY7GD 71D7FUbAXrzvzKvSwkf0tyfkKUEv89I81c3K/dlNrf0KuBRoZTRr33j1O7PrMqdsQBds IRtWiNJwV65g9HPWtifbWLR+R6iLuKrz5/NzZcX7uKGtO8dVzOX92jT17zKB1c8J+3Tj hbug== X-Forwarded-Encrypted: i=1; AL+hErFvoqdmHsVy5v0ayxzo85JlRSm91BDWsuJiFXycBHfsfblCGOMn6w0XnVo6kO+y4nYBuX9w@lists.linux.dev X-Gm-Message-State: APuU4Z8H/3XuoOANmTZAFPBOHFy/X1wbP9d1cfHz2NYihGbm65UOngOq xUMYUD9UKp5NCmmpbzHoNPkhBKW6ZJ+XwTGvMAvCZcqA/dQPBDNPFuNnpUPP/Oxh74GwBP+/8WT H8zeMMdDcCw== 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: llvm@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