kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init()
@ 2020-05-27  2:24 Wei Yongjun
  2020-05-27  2:28 ` [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini Chatradhi, Naveen Krishna
  2020-05-27  3:25 ` Guenter Roeck
  0 siblings, 2 replies; 5+ messages in thread
From: Wei Yongjun @ 2020-05-27  2:24 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi, Jean Delvare, Guenter Roeck
  Cc: Wei Yongjun, linux-hwmon, kernel-janitors, Hulk Robot

Add the missing platform_driver_unregister() before return
from amd_energy_init() in the error handling case.

Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/hwmon/amd_energy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c
index bc8b643a37d5..e95b7426106e 100644
--- a/drivers/hwmon/amd_energy.c
+++ b/drivers/hwmon/amd_energy.c
@@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
 		return ret;
 
 	amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
-	if (!amd_energy_platdev)
+	if (!amd_energy_platdev) {
+		platform_driver_unregister(&amd_energy_driver);
 		return -ENOMEM;
+	}
 
 	ret = platform_device_add(amd_energy_platdev);
 	if (ret) {

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

* RE: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini
  2020-05-27  2:24 [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init() Wei Yongjun
@ 2020-05-27  2:28 ` Chatradhi, Naveen Krishna
  2020-05-27  2:32   ` Randy Dunlap
  2020-05-27  3:25 ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Chatradhi, Naveen Krishna @ 2020-05-27  2:28 UTC (permalink / raw)
  To: Wei Yongjun, Jean Delvare, Guenter Roeck
  Cc: linux-hwmon, kernel-janitors, Hulk Robot

[AMD Official Use Only - Internal Distribution Only]

Hi Yongjun,

Thanks,
Acked-by: Naveen krishna Chatradhi <nchatrad@amd.com>

-----Original Message-----
From: linux-hwmon-owner@vger.kernel.org <linux-hwmon-owner@vger.kernel.org> On Behalf Of Wei Yongjun
Sent: Wednesday, May 27, 2020 7:54 AM
To: Chatradhi, Naveen Krishna <NaveenKrishna.Chatradhi@amd.com>; Jean Delvare <jdelvare@suse.com>; Guenter Roeck <linux@roeck-us.net>
Cc: Wei Yongjun <weiyongjun1@huawei.com>; linux-hwmon@vger.kernel.org; kernel-janitors@vger.kernel.org; Hulk Robot <hulkci@huawei.com>
Subject: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init()

[CAUTION: External Email]

Add the missing platform_driver_unregister() before return from amd_energy_init() in the error handling case.

Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/hwmon/amd_energy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index bc8b643a37d5..e95b7426106e 100644
--- a/drivers/hwmon/amd_energy.c
+++ b/drivers/hwmon/amd_energy.c
@@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
                return ret;

        amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
-       if (!amd_energy_platdev)
+       if (!amd_energy_platdev) {
+               platform_driver_unregister(&amd_energy_driver);
                return -ENOMEM;
+       }

        ret = platform_device_add(amd_energy_platdev);
        if (ret) {

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

* Re: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini
  2020-05-27  2:28 ` [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini Chatradhi, Naveen Krishna
@ 2020-05-27  2:32   ` Randy Dunlap
  2020-05-27  3:23     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2020-05-27  2:32 UTC (permalink / raw)
  To: Chatradhi, Naveen Krishna, Wei Yongjun, Jean Delvare, Guenter Roeck
  Cc: linux-hwmon, kernel-janitors, Hulk Robot

On 5/26/20 7:28 PM, Chatradhi, Naveen Krishna wrote:
> [AMD Official Use Only - Internal Distribution Only]
> 
> Hi Yongjun,
> 
> Thanks,
> Acked-by: Naveen krishna Chatradhi <nchatrad@amd.com>
> 
> -----Original Message-----
> From: linux-hwmon-owner@vger.kernel.org <linux-hwmon-owner@vger.kernel.org> On Behalf Of Wei Yongjun
> Sent: Wednesday, May 27, 2020 7:54 AM
> To: Chatradhi, Naveen Krishna <NaveenKrishna.Chatradhi@amd.com>; Jean Delvare <jdelvare@suse.com>; Guenter Roeck <linux@roeck-us.net>
> Cc: Wei Yongjun <weiyongjun1@huawei.com>; linux-hwmon@vger.kernel.org; kernel-janitors@vger.kernel.org; Hulk Robot <hulkci@huawei.com>
> Subject: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init()
> 
> [CAUTION: External Email]
> 
> Add the missing platform_driver_unregister() before return from amd_energy_init() in the error handling case.
> 
> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
> Reported-by: Hulk Robot <hulkci@huawei.com>

Hi Yongjun,

Does this Reported-by: say (imply) that hulkci is doing semantic analysis?

Is there any writeup or summary of what hulkci does?

> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/hwmon/amd_energy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index bc8b643a37d5..e95b7426106e 100644
> --- a/drivers/hwmon/amd_energy.c
> +++ b/drivers/hwmon/amd_energy.c
> @@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
>                 return ret;
> 
>         amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
> -       if (!amd_energy_platdev)
> +       if (!amd_energy_platdev) {
> +               platform_driver_unregister(&amd_energy_driver);
>                 return -ENOMEM;
> +       }
> 
>         ret = platform_device_add(amd_energy_platdev);
>         if (ret) {
> 


thanks.
-- 
~Randy

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

* Re: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini
  2020-05-27  2:32   ` Randy Dunlap
@ 2020-05-27  3:23     ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2020-05-27  3:23 UTC (permalink / raw)
  To: Randy Dunlap, Chatradhi, Naveen Krishna, Wei Yongjun, Jean Delvare
  Cc: linux-hwmon, kernel-janitors, Hulk Robot

On 5/26/20 7:32 PM, Randy Dunlap wrote:
> On 5/26/20 7:28 PM, Chatradhi, Naveen Krishna wrote:
>> [AMD Official Use Only - Internal Distribution Only]
>>
>> Hi Yongjun,
>>
>> Thanks,
>> Acked-by: Naveen krishna Chatradhi <nchatrad@amd.com>
>>
>> -----Original Message-----
>> From: linux-hwmon-owner@vger.kernel.org <linux-hwmon-owner@vger.kernel.org> On Behalf Of Wei Yongjun
>> Sent: Wednesday, May 27, 2020 7:54 AM
>> To: Chatradhi, Naveen Krishna <NaveenKrishna.Chatradhi@amd.com>; Jean Delvare <jdelvare@suse.com>; Guenter Roeck <linux@roeck-us.net>
>> Cc: Wei Yongjun <weiyongjun1@huawei.com>; linux-hwmon@vger.kernel.org; kernel-janitors@vger.kernel.org; Hulk Robot <hulkci@huawei.com>
>> Subject: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init()
>>
>> [CAUTION: External Email]
>>
>> Add the missing platform_driver_unregister() before return from amd_energy_init() in the error handling case.
>>
>> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
> 
> Hi Yongjun,
> 
> Does this Reported-by: say (imply) that hulkci is doing semantic analysis?
> 
> Is there any writeup or summary of what hulkci does?
> 
The tag is quite common nowadays.

$ git log | grep "Hulk Robot" | wc
    869    3476   41712

https://lwn.net/Articles/804119/:

"At the top of the "by changesets" column is Yue Haibing, who fixed a large number of small problems
 all over the kernel. The bulk of these problems, it seems, have been found using a system at Huawei
 called Hulk Robot, which uses various Coccinelle scripts and reports the results."

Guenter

>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>>  drivers/hwmon/amd_energy.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c index bc8b643a37d5..e95b7426106e 100644
>> --- a/drivers/hwmon/amd_energy.c
>> +++ b/drivers/hwmon/amd_energy.c
>> @@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
>>                 return ret;
>>
>>         amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
>> -       if (!amd_energy_platdev)
>> +       if (!amd_energy_platdev) {
>> +               platform_driver_unregister(&amd_energy_driver);
>>                 return -ENOMEM;
>> +       }
>>
>>         ret = platform_device_add(amd_energy_platdev);
>>         if (ret) {
>>
> 
> 
> thanks.
> 

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

* Re: [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini
  2020-05-27  2:24 [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init() Wei Yongjun
  2020-05-27  2:28 ` [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini Chatradhi, Naveen Krishna
@ 2020-05-27  3:25 ` Guenter Roeck
  1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2020-05-27  3:25 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Naveen Krishna Chatradhi, Jean Delvare, linux-hwmon,
	kernel-janitors, Hulk Robot

On Wed, May 27, 2020 at 02:24:17AM +0000, Wei Yongjun wrote:
> Add the missing platform_driver_unregister() before return
> from amd_energy_init() in the error handling case.
> 
> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> Acked-by: Naveen krishna Chatradhi <nchatrad@amd.com>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/amd_energy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c
> index bc8b643a37d5..e95b7426106e 100644
> --- a/drivers/hwmon/amd_energy.c
> +++ b/drivers/hwmon/amd_energy.c
> @@ -379,8 +379,10 @@ static int __init amd_energy_init(void)
>  		return ret;
>  
>  	amd_energy_platdev = platform_device_alloc(DRVNAME, 0);
> -	if (!amd_energy_platdev)
> +	if (!amd_energy_platdev) {
> +		platform_driver_unregister(&amd_energy_driver);
>  		return -ENOMEM;
> +	}
>  
>  	ret = platform_device_add(amd_energy_platdev);
>  	if (ret) {

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

end of thread, other threads:[~2020-05-27  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  2:24 [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_init() Wei Yongjun
2020-05-27  2:28 ` [PATCH -next] hwmon: amd_energy: Missing platform_driver_unregister() on error in amd_energy_ini Chatradhi, Naveen Krishna
2020-05-27  2:32   ` Randy Dunlap
2020-05-27  3:23     ` Guenter Roeck
2020-05-27  3:25 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).