Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp906113rwb; Thu, 19 Jan 2023 04:20:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXukVwBQKIKwkCa0qzuO2rp5rog+TtD7VsEuCAVMQL2G6Qo0L8QxCFrBFIzQrNFh/p8/2nMW X-Received: by 2002:a17:902:e811:b0:194:5066:fc20 with SMTP id u17-20020a170902e81100b001945066fc20mr14671258plg.40.1674130838545; Thu, 19 Jan 2023 04:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674130838; cv=none; d=google.com; s=arc-20160816; b=fwMeM/EYcBoQPqhgc4rRBh/AP7tPfwGNwVIfNQbEf3ntN8h0cczGrCKi8v8djJor8z GxnJgWVIIH/eULTVHq/ONUOV7eJv6KOKbqtJG3Z5CEU60GHSYGZy6msua1Hp4AbycNit +p1PXhx8jK3Qx+UDkPMF8H8AiB2T+xw/Ns9TdIeJvXi9GebwlEGXAahyl7cRJpmB14gE 3vqLdqr5/uuT0kHnUvZYx1DY/fFNLFSl7nDXRXwJ5lYnmrC7Gszcv9WJBi0g5xhntPNs 1T7Oh1F9uVhgj3lraKAAPbJizC7xhD1tQfOR3XJxDwdw6rrVD4t2gpAmaSWm0pzBxuWQ x2vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=REGjeTPbZk4DoCVcHgFfFyTkT80xKveDiZMOpebK+fw=; b=G+s6ogTadzI2UZUht8ta/EwV1uq3b4fjPG3o864wS8BCAX5mIeEzH5l7lPcW/spN8T un98bS5SRgoflxvQdiz6KVI4XI6K7IugrME8KIbUkqBpE6S80KtPnkJvdKydT/0t0Esz kmsLVbDXvnRmnSRRKDNU+Ne4H7IUesJibbwiupBYXmkFgE24y0biN1yMv9L3sJ6IV+X1 aXZx2eLw9loH2iFWNYI7xuhLaEVHgvWveddpgLOxXBqXW5ocXPlWi89UnSyyV5S0VOi4 uNrZw++K9BZTS560bRPkuyxn5BTdrikqEzv4nB0ixmgNx70wWpDphDaiOf/u3AsGhd5m OMkw== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a17090300d300b001895608367csi2821385plc.535.2023.01.19.04.20.33; Thu, 19 Jan 2023 04:20:38 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231149AbjASMLk (ORCPT + 44 others); Thu, 19 Jan 2023 07:11:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231138AbjASMLg (ORCPT ); Thu, 19 Jan 2023 07:11:36 -0500 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E500F69233; Thu, 19 Jan 2023 04:11:34 -0800 (PST) Received: by mail-ed1-f46.google.com with SMTP id x36so2550042ede.13; Thu, 19 Jan 2023 04:11:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=REGjeTPbZk4DoCVcHgFfFyTkT80xKveDiZMOpebK+fw=; b=VpqHnwzvDoZZV+sCo3cy99znMCblf/GymMyk2CvJk5bmtRplk7up694uJ0qPuc0lJe METTTewg3qZ/b95wbinR8Iw7NteeszPkHy2nPD5Piq3fP+0sBaBx3pi9XEH3ierg5UVi 0Oi8FLZ0kKCITMDJflb2v9vux3Ft0twX6DBJKIO2rChEXgjmbZF6wvceameIlxN7Kq1B igT+k7i7MbSUpLFXkewFTAOKp2LvaK3fQq5IDnOkIUNKySobdQpQIwmxZri4LkX0V5g4 Fa9dGloC1XNAdCAxU3Bm9WKbDyZpLFFuJjt2/g6pjD1GWM73OpeGG3k6Gi7w2l+/iyrp IsiA== X-Gm-Message-State: AFqh2krTE1+9qINkqNEL3H+qEcwmIgd0dfXPoB5Fki+1DDh3Exy48Air CohYIZkSWokrghzMUrwx/y/htWGaGntFUfi72TQ= X-Received: by 2002:a05:6402:4498:b0:495:f184:3971 with SMTP id er24-20020a056402449800b00495f1843971mr1510009edb.95.1674130293309; Thu, 19 Jan 2023 04:11:33 -0800 (PST) MIME-Version: 1.0 References: <20230118211123.111493-1-daniel.lezcano@linaro.org> <20230118211123.111493-3-daniel.lezcano@linaro.org> <92a6e8494b92f0bb8cb36c98d2237ee3d347c358.camel@intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 19 Jan 2023 13:11:21 +0100 Message-ID: Subject: Re: [PATCH 3/5] thermal/core: Remove unneeded mutex_destroy() To: Daniel Lezcano Cc: "Zhang, Rui" , "rafael@kernel.org" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "amitk@kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Thu, Jan 19, 2023 at 10:30 AM Daniel Lezcano wrote: > > On 19/01/2023 08:41, Zhang, Rui wrote: > > On Wed, 2023-01-18 at 22:11 +0100, Daniel Lezcano wrote: > >> If the thermal framework fails to initialize, the mutex can be used > >> by > >> the different functions registering a thermal zone anyway. > > > > Hmm, even with no governors and unregistered thermal sysfs class? > > > > IMO, thermal APIs for registering a thermal_zone/cooling_device should > > yield early if thermal_init fails. > > For other APIs that relies on a valid > > thermal_zone_device/thermal_cooling_device pointer, nothing needs to > > be changed. > > > > what do you think? > > I think you are right. > > It would be nice if we can check if the thermal class is registered and > bail out if not. But there is no function to check that AFAICS. > > Alternatively we can convert the thermal class static structure to a > pointer and set it to NULL in case of error in thermal_init() ? It doesn't matter if this is a NULL pointer or a static object that's clearly marked as unused.