Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4437921ioa; Wed, 27 Apr 2022 04:01:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCPf/3iWJSg9Ucjo3H66YK7I+DPdIyIKJb7X2enS2pwSzWkim0t2o9yjI+tE3QTvYKIxrx X-Received: by 2002:a17:90a:4983:b0:1d9:ef5:29f with SMTP id d3-20020a17090a498300b001d90ef5029fmr26972296pjh.67.1651057270125; Wed, 27 Apr 2022 04:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651057270; cv=none; d=google.com; s=arc-20160816; b=gvIUugZ4QzzjrnVp7UVgoX1BXuJnMPcGiuFz2yGn42OuC7VdYOo5MjgcHVCzJ1SsIC Fbd5PtRmxLiX1JcN11Bsbid+C9bnutaSgw4voH+O65GHvpcCuLIHyBW96T30y8aBTi2K k6os4XlCPJpPnClBpuV8ctnCAUQcg/D8e0LAMH1HZifBtEp6LMLmMV65fpZWN+7uwVRh oqUV0r1aeFQWeOE+HxI5c+TyLOUH8Z5KL7cejaxFSqPiuoY0I146oq7ykv7bvNoscf5b 2PTCiUCkvTZ0ykoHIsQ9GK9q/crYKsZFIIpRVforxUNpMig8rZVnEUZKp1ydpH/8GK8n nL3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=BI3rjOtqbGYgbTxcqvUC9Ykjt3ClBIqDuPsUvW7jLKs=; b=PGMW7BgX3cLjOzJ7CcFJbGKQcqSMCIl/0OXf0B3al3SBdNsu6GHmWUaicZMS5lhqPS MII9iGxzYaBmRYI6qJW8+tQBnAsKgFIWb0j8p2tusvZ1TEcQFL25dB6HOvYTRJY8pJgs uqCPlqq554H2YPhO4OJ2PsaifIszyvKuzj5d3K6Eyc+OwNoFbyjimM13EkxRh3k5P2rJ 04LIzy3YlE4q4RFQCvaNV2Wfhbjb0azwFYc7+HCP81M2ZyG1dcHY+0ZpqgmcoE5UbowH +X02d523f8A35qUq43uRFe2iVYYB91wYQyDMRbNSyp1mwrfMDa0t52c0A3CpQCdHoFKv yWfA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q12-20020a17090311cc00b00153b2d16657si1220196plh.607.2022.04.27.04.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:01:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 33C9D45A141; Wed, 27 Apr 2022 03:09:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352381AbiDZPin (ORCPT + 99 others); Tue, 26 Apr 2022 11:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348330AbiDZPik (ORCPT ); Tue, 26 Apr 2022 11:38:40 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0966B879 for ; Tue, 26 Apr 2022 08:35:32 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 68B0623A; Tue, 26 Apr 2022 08:35:32 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 343163F73B; Tue, 26 Apr 2022 08:35:31 -0700 (PDT) Date: Tue, 26 Apr 2022 16:35:28 +0100 From: Sudeep Holla To: Cristian Marussi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com Subject: Re: [PATCH 02/22] firmware: arm_scmi: Make protocols init fail on basic errors Message-ID: <20220426153528.bhskpchq2huhjtjk@bogus> References: <20220330150551.2573938-1-cristian.marussi@arm.com> <20220330150551.2573938-3-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330150551.2573938-3-cristian.marussi@arm.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE 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 Wed, Mar 30, 2022 at 04:05:31PM +0100, Cristian Marussi wrote: > Bail out of protocol initialization routine early when basic information > about protocol version and attributes could not be retrieved: failing to > act this way can lead to a successfully initialized SCMI protocol which > is in fact not fully functional. > > Signed-off-by: Cristian Marussi > --- > drivers/firmware/arm_scmi/base.c | 5 ++++- > drivers/firmware/arm_scmi/clock.c | 8 ++++++-- > drivers/firmware/arm_scmi/perf.c | 10 +++++++--- > drivers/firmware/arm_scmi/power.c | 10 +++++++--- > drivers/firmware/arm_scmi/reset.c | 10 +++++++--- > drivers/firmware/arm_scmi/sensors.c | 4 +++- > drivers/firmware/arm_scmi/system.c | 5 ++++- > 7 files changed, 38 insertions(+), 14 deletions(-) > > @@ -370,7 +372,9 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph) > if (!cinfo) > return -ENOMEM; > > - scmi_clock_protocol_attributes_get(ph, cinfo); > + ret = scmi_clock_protocol_attributes_get(ph, cinfo); > + if (ret) > + return ret; Does this result in removal of scmi_dev associated with devm_* calls ? Otherwise we may need to free the allocated buffers ? I am not sure if the dev here is individual scmi_dev or the platform scmi device. I assume latter and it is unlikely to be removed/freed with the error in the above path. Similarly in couple of other instances/protocols. -- Regards, Sudeep