Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp127363lqd; Tue, 23 Apr 2024 17:52:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZU5/yQ2T3b6qeuC4oYKwzwoUwl1uaVt65NW4anG7hZ6oG+ISLa/no2nCXtQf6pvn98z3E7w3AjsPUSb5Av727RZEq+uoG6CnIRakKjA== X-Google-Smtp-Source: AGHT+IF54OVKwy+XU0XjsqhHH72VkuHPMq4gHAEtE4eAjjGW+WS4j8fnEH/JyQrueJQkPK111Dri X-Received: by 2002:a05:6808:13d4:b0:3c7:5371:6a24 with SMTP id d20-20020a05680813d400b003c753716a24mr1125229oiw.8.1713919952987; Tue, 23 Apr 2024 17:52:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713919952; cv=pass; d=google.com; s=arc-20160816; b=nZONEJiOljmFZ1h6oOcW9hTjkCWeqIEaDhUVQ5Eu7B6dU5wPoJ707r4gKqZUMk48lT 07sBq9SzE7dmaQhNxqpLwH9QCBsE+AT0AkNouTy98lDVMYoIlA2lPbQB3jEa+bWMkOvV vYOqXZcXxAa6TGRMJ67u4amxvAhSLW0c0CPWmaqiCQvYQPQ28TU+MtpeVMel2PAQ9ru/ oFjl0VJo+oFBcgKY0KcF1S3NARxudempDrhegvuF0il9CQfzzeWREBXKYU0vWeC7GzS4 bEmu41Emj8S7tBQVLw0zUXdSUzFhjwWmo21TrkBpQL/ipqrPHq+BWqOmxsxyblxpOe8V 6ndw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7x8qzh/xNTzgv5GapGD1VxRCi9BfqOYg3PSO8SAGVoY=; fh=+8e0jJUdEhPOqPHzboM1BeLXewPYplf+dyyXABCJLpI=; b=SJiP359VKn5HLEPf4cE5j8GUUH/ZrGc+/HGJPavXujB9TkFulKl0skAWr4stZsni76 pGoNFMdgWh9wnHVXpEzI0AVMtsi0rCUUtH6z0RrKwqkscSKjkAFjjhNQp44vjH/KghJr Xkvur+Xu3rkK2LoF8R5Ba3VlzX59sds13seN6yJRTpko6U87lmPglH9HXPHInp9ItF0r MeNmELTMYwJ9Vs0CNKbif5rEObh3cPIkgrQSnrv7jGVr25gbeCRfWpX7xVZXtjNP5fQY tudcMdKp6hDLkN3a6zI68TKwyvmGpAn9sJjzWE2k+DKq6l3wtpLW9B7p2dCSGjOcWLyl xlvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MsAOrce8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-155869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s17-20020a639251000000b005fd09289377si6092425pgn.16.2024.04.23.17.52.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 17:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MsAOrce8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-155869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 54FD7285231 for ; Tue, 23 Apr 2024 20:48:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DBF2144D38; Tue, 23 Apr 2024 20:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MsAOrce8" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CB9813E02C; Tue, 23 Apr 2024 20:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713905189; cv=none; b=I0w/DXUxWc7eJqG3wbxO/TKyw/X1s2cgBB10v9RXBPc5xmHhpwPXKKuCJ6x9VrhPOvtTEX1FQ1AlcN0NEusKa5LqRiO3Ivp2/q5lcHlvlwe1AM2MEs+E1Je8IGxdXP2tw5dIr4tzS2QkIMYkk1IZ+cY/fI/HEaeY9DWtGeLIhGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713905189; c=relaxed/simple; bh=I8WlCO7J0Bkb/d2OhXTFjWUNzIGy1ipush1doJz1FUY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=htj8LtOb+anjG2nPNJpWImFN215p1hiGjEoF5D/BWMo95mtdZAt5HiaKCT5dFHhgKGG3YwbeleVk2FXZX+XIe1NXvODfswjBmxZYcCp2FX6kOUNoJfKuPuNM9dfgUKygttkgUU7fO+VPtSFs1UVYaVZ7t083zPXHaI58HakVngE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MsAOrce8; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713905188; x=1745441188; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I8WlCO7J0Bkb/d2OhXTFjWUNzIGy1ipush1doJz1FUY=; b=MsAOrce8enKHod35wZ6qMkQP3YAnt91qKn0Cls35W0r/gunZN/GRAAN7 hpoGeuC5whh7FdMMcy4LpHruh5+bQ9HDamzWa5E/ZaW4iXlxN29kyfgqb KYZKkPnG42LRjuDq+AFagOyBnU+9vI/jdMUecaqodMoOuEPzL3ftjKJgb p4dzntGz97LEtKDPMbwbHQ2WlZYNkzJT23QRrgkH1594I7NfM6sHAMMmE AyiO3btSQeIvpcp2/nifZvliU3ohXYyaYC9W+6kyBntYrfE+AeDl+RPnc gqwQy8u96Dvb1I1pVx0/fWfkUlMV1wkX+jgAyRx9g1p8lL0+f/v5g10Lx g==; X-CSE-ConnectionGUID: R3blV5sKSWK+jFpWAPcY3Q== X-CSE-MsgGUID: CIHJZ+CMSeKZI8ODNlJO6Q== X-IronPort-AV: E=McAfee;i="6600,9927,11053"; a="34912332" X-IronPort-AV: E=Sophos;i="6.07,222,1708416000"; d="scan'208";a="34912332" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2024 13:46:25 -0700 X-CSE-ConnectionGUID: OsTMaS0AQdKUURh0e7oLDw== X-CSE-MsgGUID: Sz08ig30S+21tyyoFhL86Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,222,1708416000"; d="scan'208";a="24533091" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmviesa010.fm.intel.com with ESMTP; 23 Apr 2024 13:46:24 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada , Andy Shevchenko Subject: [PATCH 08/10] platform/x86: ISST: Use in_range() to check package ID validity Date: Tue, 23 Apr 2024 13:46:17 -0700 Message-Id: <20240423204619.3946901-9-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240423204619.3946901-1-srinivas.pandruvada@linux.intel.com> References: <20240423204619.3946901-1-srinivas.pandruvada@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use in_range() macro to simplify range check. No functional impact is expected. Signed-off-by: Srinivas Pandruvada Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Reviewed-by: Ilpo Järvinen --- drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index b8da6847622b..e75fb9eba598 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -531,8 +531,7 @@ static struct tpmi_per_power_domain_info *get_instance(int pkg_id, int power_dom struct tpmi_sst_struct *sst_inst; u8 part; - if (pkg_id < 0 || pkg_id > isst_common.max_index || - pkg_id >= topology_max_packages()) + if (!in_range(pkg_id, 0, topology_max_packages()) || pkg_id > isst_common.max_index) return NULL; sst_inst = isst_common.sst_inst[pkg_id]; -- 2.40.1