public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: ISST: Fix return value on last invalid resource
@ 2024-08-16 16:36 Srinivas Pandruvada
  2024-08-20 11:23 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2024-08-16 16:36 UTC (permalink / raw)
  To: hdegoede, ilpo.jarvinen
  Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada, stable

When only the last resource is invalid, tpmi_sst_dev_add() is returing
error even if there are other valid resources before. This function
should return error when there are no valid resources.

Here tpmi_sst_dev_add() is returning "ret" variable. But this "ret"
variable contains the failure status of last call to sst_main(), which
failed for the invalid resource. But there may be other valid resources
before the last entry.

To address this, do not update "ret" variable for sst_main() return
status.

Fixes: 9d1d36268f3d ("platform/x86: ISST: Support partitioned systems")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <stable@vger.kernel.org> # 6.10+
---
 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 7fa360073f6e..404582307109 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
@@ -1549,8 +1549,7 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev)
 			goto unlock_free;
 		}
 
-		ret = sst_main(auxdev, &pd_info[i]);
-		if (ret) {
+		if (sst_main(auxdev, &pd_info[i])) {
 			/*
 			 * This entry is not valid, hardware can partially
 			 * populate dies. In this case MMIO will have 0xFFs.
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: ISST: Fix return value on last invalid resource
  2024-08-16 16:36 [PATCH] platform/x86: ISST: Fix return value on last invalid resource Srinivas Pandruvada
@ 2024-08-20 11:23 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2024-08-20 11:23 UTC (permalink / raw)
  To: Srinivas Pandruvada; +Cc: Hans de Goede, platform-driver-x86, LKML, stable

On Fri, 16 Aug 2024, Srinivas Pandruvada wrote:

> When only the last resource is invalid, tpmi_sst_dev_add() is returing
> error even if there are other valid resources before. This function
> should return error when there are no valid resources.
> 
> Here tpmi_sst_dev_add() is returning "ret" variable. But this "ret"
> variable contains the failure status of last call to sst_main(), which
> failed for the invalid resource. But there may be other valid resources
> before the last entry.
> 
> To address this, do not update "ret" variable for sst_main() return
> status.
>
> Fixes: 9d1d36268f3d ("platform/x86: ISST: Support partitioned systems")
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: <stable@vger.kernel.org> # 6.10+

Thanks for the patch. Applied to review-ilpo.

While applying, I added the answer to the obvious question: why no new 
checks are needed for the no valid resources case (essentially, noting the 
existing !inst check).

-- 
 i.

> ---
>  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 7fa360073f6e..404582307109 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
> @@ -1549,8 +1549,7 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev)
>  			goto unlock_free;
>  		}
>  
> -		ret = sst_main(auxdev, &pd_info[i]);
> -		if (ret) {
> +		if (sst_main(auxdev, &pd_info[i])) {
>  			/*
>  			 * This entry is not valid, hardware can partially
>  			 * populate dies. In this case MMIO will have 0xFFs.
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-20 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 16:36 [PATCH] platform/x86: ISST: Fix return value on last invalid resource Srinivas Pandruvada
2024-08-20 11:23 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox