Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3152262rwb; Fri, 20 Jan 2023 11:58:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhrvh/HBkn71Fq9GLRaFaY+eAuil6rwnr2XTerzE84lqgMri8zxbGjkxH+RBVjCn4q9pe2 X-Received: by 2002:a17:907:214c:b0:838:1b80:9a7a with SMTP id rk12-20020a170907214c00b008381b809a7amr16488022ejb.12.1674244697581; Fri, 20 Jan 2023 11:58:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674244697; cv=none; d=google.com; s=arc-20160816; b=rh6oCgUwa+/zfW8ITJvBa1rXJKc2T6wbOvTxxQN13cnMWQ3t8v0Kvobw9Ke1lg8v9k 9Y1FNVWqNq3oq9qR9tOszw9gn2L6a01zIQGDmbaVJH/ZFtya2tvvzrp8ol9gcdixCp9a Ymwt9Pod5C4AoYwTzSnm+BTwCJuWorUiwSi7pQcXSIkTO1BI9/fwQTcC4x9Y+wOHWxSN 5NHzf4EVFz4HCDdvODLpCyV97zW0aub1TBqnzTA6AeMxZrLDne1vy/HJKDWtxwWnyeSs s8qWoaw6Rnsb8/p7RRm5kyvGh/p+qUVBPUTc1hgs2zEz1VSqr0bOjP63QJh4udthTE54 E8VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GX04MSGsgNhsVZr6Ze3VC7DYU7ePdFRAOShaNbmlehg=; b=n1xh1Plxvrqd1/J0+sPHXUUukARUWj+4VogJ/8YQKUocbmkDdaH/D1jMrZXx+tlk53 s3wPi1dNY4ytFW97xW/laUyOcMiXUNxr+AzFFMtJXUZP6PWnducK0D7drgi2Cw/lghZO inUqEuW9MrDmXAW1iFoiNgvesfpigbjz6mhXiTn62Mod+hABr4tU/jRA4DyNn5m3BdS1 rHcDV+8OkH6/+zpkNfR/AGrndTNzE4QQ6FwE0BmHGG/ExCcRfNyz5rtgGYwlEhltxeOF pZRWaMtZObcUsN6t14ujI/fowAQqzLtpgSJaw22FWVC64h6Y4H24RmyTZmxZw439sT0G wkoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn41-20020a1709070d2900b0086f0864592dsi20872094ejc.321.2023.01.20.11.58.04; Fri, 20 Jan 2023 11:58:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjATTtB (ORCPT + 50 others); Fri, 20 Jan 2023 14:49:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbjATTsn (ORCPT ); Fri, 20 Jan 2023 14:48:43 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B7ABB96; Fri, 20 Jan 2023 11:48:35 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id 09fbaefc78dc5128; Fri, 20 Jan 2023 20:48:33 +0100 Received: from kreacher.localnet (unknown [213.134.183.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 26BDD23101AB; Fri, 20 Jan 2023 20:48:33 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM , Greg Kroah-Hartman Cc: LKML , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui Subject: [PATCH v1 0/2] driver core/thermal: Fail registration of thermal object when thermal_class is not registered Date: Fri, 20 Jan 2023 20:45:09 +0100 Message-ID: <5905717.lOV4Wx5bFT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.183.98 X-CLIENT-HOSTNAME: 213.134.183.98 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudduvddgudefvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeffffffkefgheehffelteeiveeffeevhfelteejvddvieejjeelvdeiheeuveeuffenucfkphepvddufedrudefgedrudekfedrleeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekfedrleekpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgt phhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, If thermal_class is not registered, the whole thermal framework is basically unusable, because the governors are not there and its sysfs interface is not present. In that case it doesn't make sense to register thermal zones and cooling devices, because they cannot be used as expected anyway, so make it possible to fail the registration of these things if the registration of thermal_class has failed. To that end, make sure that the private pointer of a class is NULL when that class is not registered with the driver core (patch [1/2]). Next, make the thermal framework check the value of the thermal_class' private pointer against NULL and fail the registration of thermal zones and cooling devices when it is NULL (patch [2/2]). Thanks!