From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F8C4ECAAD3 for ; Thu, 1 Sep 2022 19:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234650AbiIATvX (ORCPT ); Thu, 1 Sep 2022 15:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbiIATvW (ORCPT ); Thu, 1 Sep 2022 15:51:22 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E13D474D9; Thu, 1 Sep 2022 12:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662061881; x=1693597881; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=k5zr5cn7hQsp9fLMDnqTgBbt08cY9uQCohw6Rm0BqxI=; b=ZMvFsflWrWRlRo3AMQ/7bJvN0Ni4CAbAi4XH7R65BTO8iPxrWNOu7CW2 a16hubBIqCo4mm1wSerSYY7Po/+5YkgFcG6cy2F3Y7OwCmNJ4KVP1dV5j 8U2Ua+vG61kDbEaK2WSN1p6VUPUQ9GBlUCBObA+wjxO6g3XjTpLmX7aaa U5CxIBMO0yzS8pfn8PGITlGNuSOrwlw+jmZ6kqIDjxzW09IYoIihyoDDb /S0zN0SSCg3m7cQepPioMKxfv0zqsD9ElehYZp8t+7a7q+7xSyPBlxX2j q1Zk7kxz6YaBabvggqbBpyxu/z6EE0/FNn4U5oB1vSZRj0Cl4OOYkrn5V g==; X-IronPort-AV: E=McAfee;i="6500,9779,10457"; a="294554904" X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="294554904" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 12:51:20 -0700 X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="563598121" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 12:51:15 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oTqBQ-0071RD-3A; Thu, 01 Sep 2022 22:49:00 +0300 Date: Thu, 1 Sep 2022 22:49:00 +0300 From: Andy Shevchenko To: "Farber, Eliav" Cc: Guenter Roeck , jdelvare@suse.com, robh+dt@kernel.org, p.zabel@pengutronix.de, rtanwar@maxlinear.com, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, talel@amazon.com, hhhawa@amazon.com, jonnyc@amazon.com, hanochu@amazon.com, ronenk@amazon.com, itamark@amazon.com, shellykz@amazon.com, shorer@amazon.com, amitlavi@amazon.com, almogbs@amazon.com, dkl@amazon.com Subject: Re: [PATCH v3 02/19] hwmon: (mr75203) fix VM sensor allocation when "intel, vm-map" not defined Message-ID: References: <20220830192212.28570-1-farbere@amazon.com> <20220830192212.28570-3-farbere@amazon.com> <84a68eff-be64-71ce-1533-1e228d3da2a4@amazon.com> <71d6d57c-2165-5fe3-515d-9395022921e2@roeck-us.net> <2f5c5828-87b9-f3d2-e3d3-0200adbe830c@amazon.com> <20220901144434.GB3477025@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Thu, Sep 01, 2022 at 06:24:51PM +0300, Farber, Eliav wrote: > On 9/1/2022 5:44 PM, Guenter Roeck wrote: > > On Thu, Sep 01, 2022 at 11:39:58AM +0300, Farber, Eliav wrote: ... > > There should be some error handling to catch this case (ie if the number > > of entries does not match the expected count), or if a value in the array > > is larger or equal to vm_num. Today the latter is silently handled as end > > of entries (similar to 0xff), but that should result in an error. > > This would avoid situations like > >        intel,vm-map = [01 02 03 04 05]; > > ie where the person writing the devicetree file accidentally entered > > index values starting with 1 instead of 0. A mismatch between vm_num > > and the number of entries in the array is silently handled as if there > > was no property at all, which is at the very least misleading and > > most definitely unexpected and should also result in an error. > > I assume it is possible to tell according to the return value, if property > doesn’t exist at all, or if it does exists and size of array in > device-tree is smaller than vm_num. > In [PATCH v3 17/19] Andy wrote that “code shouldn't be a YAML validator. > Drop this and make sure you have correct DT schema” so I’m a bit confused > if code should validate “intel,bm-map” or if it is the user responsibility. > As this property was not added by me, I prefer not to fix it as part of > this series of patches. I'm just a messenger of Rob's words. If I'm mistaken I would like Rob to correct me. -- With Best Regards, Andy Shevchenko