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 85063C433EF for ; Wed, 25 May 2022 17:47:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343493AbiEYRrV (ORCPT ); Wed, 25 May 2022 13:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245758AbiEYRrT (ORCPT ); Wed, 25 May 2022 13:47:19 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC412018E for ; Wed, 25 May 2022 10:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653500839; x=1685036839; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cy/ZY9c51u1GO5cX9KHF384E8b0FjTATLJGVU/vYlwc=; b=FU/gATtdXShFHZ897wMtvRtMSHNQBgHJF28tjobn3LXAobq/OFh851mF k9q33yhG7UEopUJo1J3zeXRlYj8asS2YWdLOqtdl+i+LjGBV8/i6aNtBl WvCNI0037/6FiQhBr/9oPazV5N4RF+mum5iJTmkMKWZqjZw0iMVCMbOPX boR1vgnC9fSlsPiCQnjqlXaaA91+BT2Wod1C3PzLg1+Lgcl/Hw2k3RxQ+ Z6MmrEtFIN8oyft+YNH29N3rVw1T3XHsC/ILpdNMW+DYpi1zv/DoLyPVF hl0PwZYS82gOMkqmmMDbu0ReDomoCYKBS4Wur9dMqAvE7EW9IE1ZoDQ8Z A==; X-IronPort-AV: E=McAfee;i="6400,9594,10358"; a="272705138" X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="272705138" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 10:36:58 -0700 X-IronPort-AV: E=Sophos;i="5.91,250,1647327600"; d="scan'208";a="745849176" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 10:36:57 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1ntuwI-000L5k-IO; Wed, 25 May 2022 20:36:54 +0300 Date: Wed, 25 May 2022 20:36:54 +0300 From: Andy Shevchenko To: Sakari Ailus Cc: linux-acpi@vger.kernel.org, rafael@kernel.org Subject: Re: [PATCH v3 8/8] ACPI: property: Read buffer properties as integers Message-ID: References: <20220525130123.767410-1-sakari.ailus@linux.intel.com> <20220525130123.767410-9-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220525130123.767410-9-sakari.ailus@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Wed, May 25, 2022 at 04:01:23PM +0300, Sakari Ailus wrote: > Instead of adding a new property type, read buffer properties as integers. > Even though the internal representation in ACPI is different, the data > type is the same (byte) than on 8-bit integers. ... > + switch (proptype) { > + case DEV_PROP_STRING: > + break; > + case DEV_PROP_U8 ... DEV_PROP_U64: > + if (obj->type == ACPI_TYPE_BUFFER) { > + if (nval <= obj->buffer.length) > + break; > + return -EOVERFLOW; Why not traditional pattern and be consistent with default case? if (nval > obj->buffer.length) return -EOVERFLOW; break; > + } > + fallthrough; > + default: > + if (nval > obj->package.count) > + return -EOVERFLOW; I would add break statement here. > + } > if (nval == 0) > return -EINVAL; -- With Best Regards, Andy Shevchenko