Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp849525rdb; Tue, 19 Sep 2023 12:01:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHiS+7oc5ricyMUqE9CTcXBCf0/vsh84EjOhnDeDrkO1VlzkXIOtitHkoAzmtvrVaPXYYos X-Received: by 2002:a17:902:e5ce:b0:1c3:868f:5958 with SMTP id u14-20020a170902e5ce00b001c3868f5958mr4372837plf.20.1695150100692; Tue, 19 Sep 2023 12:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695150100; cv=none; d=google.com; s=arc-20160816; b=nS5JEotCE4UgcPfroku0hyKjDI47McvyTwEewjf9EOw6o0amEH8Nr7CHlgCw0j+ybi 5H86H9zfQoytTYH4SYo1qGsNXyfEmgxYAhCZKcsJZEpTiI+LE2YVDQIthNA4GQ6cYsFd VN3/2a34QHXut7dk9OIxgBbx5Hc8HlwEhZiG2Gu9yKMuQXiRkr76DKvDWR692eEj7FG9 qgy0t4m+AMYHcgvHhNTSz/hFU9VQtxoQaRiWrO3HW9c+jH+HvOBWrlgv0WYBMXs2ASSX 55OHthSfqQY0+RNuKhsZyl6MJDCDFs76b/Gidl/mml0EjHWV40Gd3sGplGRzQeYd7hhl NcCQ== 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=gcLgaKreOEs0HfWYEVlK3oWWhI2u09wLHbBBzZWDcoc=; fh=MU4YjG0GBN+qqU28ljjhKmK96YDURGAAG3mD3otID7I=; b=YY4Ryi9u33dxBLnT3Hn+GcnfXKJk4o75llt/PnvlhY+QpP7ZZ65FDLn9M/urjRGTL2 SEg/HvhJkxQg/g1rx+jktJbqS+da2Kl0Jt1WiW+Z+xFA9J83ic4ojGGQPpqwbEh5ffgr JddAEkTqYPaJDqMCudnrr3HTOP68UAMb/TcQJQ56CS4mXCVXOMNebI9Ird75Reze4Vt4 da+rGoahbYwGo9PHLgt31KlR7S5kwqeUY6JUM1f20hP355ggYzNYm8MmRyhQScCDmsMy FmL0C8x2R2to3eJ7my2F0qd8eRSsGm5lZZfqHBBKGwHz5x5EpTbSB+dXaAlKrjXqBWUX gaJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p18-20020a170902e75200b001c1f373ea07si3028848plf.351.2023.09.19.12.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 12:01:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0AA0C82E7B39; Tue, 19 Sep 2023 12:00:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232570AbjISTAG (ORCPT + 99 others); Tue, 19 Sep 2023 15:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbjISTAD (ORCPT ); Tue, 19 Sep 2023 15:00:03 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 578BEEA; Tue, 19 Sep 2023 11:59:56 -0700 (PDT) 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.2.0) id b5efa5a60af9636d; Tue, 19 Sep 2023 20:59:54 +0200 Authentication-Results: v370.home.net.pl; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=rjwysocki.net (client-ip=195.136.19.94; helo=[195.136.19.94]; envelope-from=rjw@rjwysocki.net; receiver=) Received: from kreacher.localnet (unknown [195.136.19.94]) (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 370506646D4; Tue, 19 Sep 2023 20:59:54 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Zhang Rui , Srinivas Pandruvada , Daniel Lezcano Subject: [PATCH v1] thermal: core: Drop redundant trips check from for_each_thermal_trip() Date: Tue, 19 Sep 2023 20:59:53 +0200 Message-ID: <5981326.lOV4Wx5bFT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudekuddguddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeffffffkefgheehffelteeiveeffeevhfelteejvddvieejjeelvdeiheeuveeuffenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhr tghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 12:00:14 -0700 (PDT) From: Rafael J. Wysocki It is invalid to call for_each_thermal_trip() on an unregistered thermal zone anyway, and as per thermal_zone_device_register_with_trips(), the trips[] table must be present if num_trips is greater than zero for the given thermal zone. Hence, the trips check in for_each_thermal_trip() is redundant and so it can be dropped. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_trip.c | 3 --- 1 file changed, 3 deletions(-) Index: linux-pm/drivers/thermal/thermal_trip.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_trip.c +++ linux-pm/drivers/thermal/thermal_trip.c @@ -17,9 +17,6 @@ int for_each_thermal_trip(struct thermal lockdep_assert_held(&tz->lock); - if (!tz->trips) - return -ENODATA; - for (i = 0; i < tz->num_trips; i++) { ret = cb(&tz->trips[i], data); if (ret)