X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc()
@ 2024-02-26 14:40 Harshit Mogalapalli
  2024-02-26 14:53 ` Ilpo Järvinen
  2024-03-04 16:57 ` Hans de Goede
  0 siblings, 2 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2024-02-26 14:40 UTC (permalink / raw)
  To: Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
	Mario Limonciello, platform-driver-x86, linux-kernel
  Cc: kernel-janitors, dan.carpenter, Harshit Mogalapalli

On the error path, assign -ENOMEM to ret when memory allocation of
"dev->prev_data" fails.

Fixes: e70961505808 ("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis with smatch, only compile tested
---
 drivers/platform/x86/amd/pmf/tee-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
index 8527dca9cf56..dcbe8f85e122 100644
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@ -458,8 +458,10 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
 	amd_pmf_hex_dump_pb(dev);
 
 	dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
-	if (!dev->prev_data)
+	if (!dev->prev_data) {
+		ret = -ENOMEM;
 		goto error;
+	}
 
 	ret = amd_pmf_start_policy_engine(dev);
 	if (ret)
-- 
2.39.3


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

* Re: [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc()
  2024-02-26 14:40 [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc() Harshit Mogalapalli
@ 2024-02-26 14:53 ` Ilpo Järvinen
  2024-02-26 15:35   ` Mario Limonciello
  2024-03-04 16:57 ` Hans de Goede
  1 sibling, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2024-02-26 14:53 UTC (permalink / raw)
  To: Harshit Mogalapalli
  Cc: Shyam Sundar S K, Hans de Goede, Mario Limonciello,
	platform-driver-x86, LKML, kernel-janitors, dan.carpenter

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

On Mon, 26 Feb 2024, Harshit Mogalapalli wrote:

> On the error path, assign -ENOMEM to ret when memory allocation of
> "dev->prev_data" fails.
> 
> Fixes: e70961505808 ("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis with smatch, only compile tested
> ---
>  drivers/platform/x86/amd/pmf/tee-if.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
> index 8527dca9cf56..dcbe8f85e122 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -458,8 +458,10 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
>  	amd_pmf_hex_dump_pb(dev);
>  
>  	dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
> -	if (!dev->prev_data)
> +	if (!dev->prev_data) {
> +		ret = -ENOMEM;
>  		goto error;
> +	}
>  
>  	ret = amd_pmf_start_policy_engine(dev);
>  	if (ret)
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

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

* Re: [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc()
  2024-02-26 14:53 ` Ilpo Järvinen
@ 2024-02-26 15:35   ` Mario Limonciello
  0 siblings, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2024-02-26 15:35 UTC (permalink / raw)
  To: Ilpo Järvinen, Harshit Mogalapalli
  Cc: Shyam Sundar S K, Hans de Goede, platform-driver-x86, LKML,
	kernel-janitors, dan.carpenter

On 2/26/2024 08:53, Ilpo Järvinen wrote:
> On Mon, 26 Feb 2024, Harshit Mogalapalli wrote:
> 
>> On the error path, assign -ENOMEM to ret when memory allocation of
>> "dev->prev_data" fails.
>>
>> Fixes: e70961505808 ("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")
>> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>> ---
>> This is based on static analysis with smatch, only compile tested
>> ---
>>   drivers/platform/x86/amd/pmf/tee-if.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
>> index 8527dca9cf56..dcbe8f85e122 100644
>> --- a/drivers/platform/x86/amd/pmf/tee-if.c
>> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
>> @@ -458,8 +458,10 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
>>   	amd_pmf_hex_dump_pb(dev);
>>   
>>   	dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
>> -	if (!dev->prev_data)
>> +	if (!dev->prev_data) {
>> +		ret = -ENOMEM;
>>   		goto error;
>> +	}
>>   
>>   	ret = amd_pmf_start_policy_engine(dev);
>>   	if (ret)
>>
> 
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 

Thanks for the patch!

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>


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

* Re: [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc()
  2024-02-26 14:40 [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc() Harshit Mogalapalli
  2024-02-26 14:53 ` Ilpo Järvinen
@ 2024-03-04 16:57 ` Hans de Goede
  1 sibling, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2024-03-04 16:57 UTC (permalink / raw)
  To: Harshit Mogalapalli, Shyam Sundar S K, Ilpo Järvinen,
	Mario Limonciello, platform-driver-x86, linux-kernel
  Cc: kernel-janitors, dan.carpenter

Hi,

On 2/26/24 15:40, Harshit Mogalapalli wrote:
> On the error path, assign -ENOMEM to ret when memory allocation of
> "dev->prev_data" fails.
> 
> Fixes: e70961505808 ("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>

Thank you for your patch/series, I've applied this patch
(series) to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in the pdx86 review-hans branch once I've
pushed my local branch there, which might take a while.

I will include this patch in my next fixes pull-req to Linus
for the current kernel development cycle.

Regards,

Hans




> ---
> This is based on static analysis with smatch, only compile tested
> ---
>  drivers/platform/x86/amd/pmf/tee-if.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
> index 8527dca9cf56..dcbe8f85e122 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -458,8 +458,10 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
>  	amd_pmf_hex_dump_pb(dev);
>  
>  	dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
> -	if (!dev->prev_data)
> +	if (!dev->prev_data) {
> +		ret = -ENOMEM;
>  		goto error;
> +	}
>  
>  	ret = amd_pmf_start_policy_engine(dev);
>  	if (ret)


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

end of thread, other threads:[~2024-03-04 16:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26 14:40 [PATCH] platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc() Harshit Mogalapalli
2024-02-26 14:53 ` Ilpo Järvinen
2024-02-26 15:35   ` Mario Limonciello
2024-03-04 16:57 ` Hans de Goede

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