diff mbox

[-next] platform/x86: dell-laptop: fix error return code in dell_init()

Message ID 1510666813-173192-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Andy Shevchenko
Headers show

Commit Message

Wei Yongjun Nov. 14, 2017, 1:40 p.m. UTC
Fix to return error code -ENOMEM from the kzalloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: 549b4930f057 ("platform/x86: dell-smbios: Introduce dispatcher for SMM calls")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/platform/x86/dell-laptop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Limonciello, Mario Nov. 14, 2017, 2:38 p.m. UTC | #1
> -----Original Message-----
> From: platform-driver-x86-owner@vger.kernel.org [mailto:platform-driver-x86-
> owner@vger.kernel.org] On Behalf Of Wei Yongjun
> Sent: Tuesday, November 14, 2017 7:40 AM
> To: mjg59@srcf.ucam.org; pali.rohar@gmail.com; dvhart@infradead.org;
> andy@infradead.org; Limonciello, Mario <Mario_Limonciello@Dell.com>
> Cc: Wei Yongjun <weiyongjun1@huawei.com>; platform-driver-
> x86@vger.kernel.org
> Subject: [PATCH -next] platform/x86: dell-laptop: fix error return code in dell_init()
> 
> Fix to return error code -ENOMEM from the kzalloc() error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 549b4930f057 ("platform/x86: dell-smbios: Introduce dispatcher for SMM
> calls")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/platform/x86/dell-laptop.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
> index c4903c5..0a8f359 100644
> --- a/drivers/platform/x86/dell-laptop.c
> +++ b/drivers/platform/x86/dell-laptop.c
> @@ -2081,8 +2081,10 @@ static int __init dell_init(void)
>  	}
> 
>  	buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL);
> -	if (!buffer)
> +	if (!buffer) {
> +		ret = -ENOMEM;
>  		goto fail_buffer;
> +	}
> 
>  	if (quirks && quirks->touchpad_led)
>  		touchpad_led_init(&platform_device->dev);

Thanks.

Acked-by: Mario Limonciello <mario.limonciello@dell.com>
Andy Shevchenko Nov. 21, 2017, 2:23 p.m. UTC | #2
On Tue, Nov 14, 2017 at 4:38 PM,  <Mario.Limonciello@dell.com> wrote:
>> -----Original Message-----
>> From: platform-driver-x86-owner@vger.kernel.org [mailto:platform-driver-x86-
>> owner@vger.kernel.org] On Behalf Of Wei Yongjun
>> Sent: Tuesday, November 14, 2017 7:40 AM
>> To: mjg59@srcf.ucam.org; pali.rohar@gmail.com; dvhart@infradead.org;
>> andy@infradead.org; Limonciello, Mario <Mario_Limonciello@Dell.com>
>> Cc: Wei Yongjun <weiyongjun1@huawei.com>; platform-driver-
>> x86@vger.kernel.org
>> Subject: [PATCH -next] platform/x86: dell-laptop: fix error return code in dell_init()
>>
>> Fix to return error code -ENOMEM from the kzalloc() error handling
>> case instead of 0, as done elsewhere in this function.
>>
>> Fixes: 549b4930f057 ("platform/x86: dell-smbios: Introduce dispatcher for SMM
>> calls")
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Pushed to my review and testing queue, thanks.

Shall we send this as material for -rc2 ?

>> ---
>>  drivers/platform/x86/dell-laptop.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
>> index c4903c5..0a8f359 100644
>> --- a/drivers/platform/x86/dell-laptop.c
>> +++ b/drivers/platform/x86/dell-laptop.c
>> @@ -2081,8 +2081,10 @@ static int __init dell_init(void)
>>       }
>>
>>       buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL);
>> -     if (!buffer)
>> +     if (!buffer) {
>> +             ret = -ENOMEM;
>>               goto fail_buffer;
>> +     }
>>
>>       if (quirks && quirks->touchpad_led)
>>               touchpad_led_init(&platform_device->dev);
>
> Thanks.
>
> Acked-by: Mario Limonciello <mario.limonciello@dell.com>
Darren Hart Nov. 22, 2017, midnight UTC | #3
On Tue, Nov 21, 2017 at 04:23:51PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 14, 2017 at 4:38 PM,  <Mario.Limonciello@dell.com> wrote:
> >> -----Original Message-----
> >> From: platform-driver-x86-owner@vger.kernel.org [mailto:platform-driver-x86-
> >> owner@vger.kernel.org] On Behalf Of Wei Yongjun
> >> Sent: Tuesday, November 14, 2017 7:40 AM
> >> To: mjg59@srcf.ucam.org; pali.rohar@gmail.com; dvhart@infradead.org;
> >> andy@infradead.org; Limonciello, Mario <Mario_Limonciello@Dell.com>
> >> Cc: Wei Yongjun <weiyongjun1@huawei.com>; platform-driver-
> >> x86@vger.kernel.org
> >> Subject: [PATCH -next] platform/x86: dell-laptop: fix error return code in dell_init()
> >>
> >> Fix to return error code -ENOMEM from the kzalloc() error handling
> >> case instead of 0, as done elsewhere in this function.
> >>
> >> Fixes: 549b4930f057 ("platform/x86: dell-smbios: Introduce dispatcher for SMM
> >> calls")
> >> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Pushed to my review and testing queue, thanks.
> 
> Shall we send this as material for -rc2 ?

I have one more queued in for-next already. So pleasae propogate this to
for-next along with anything else you want to go out and I'll send the pull
request tomorrow (Wed) to Linus. Then we'll do our transition to "Fixes"
for the RC cycle (a bit later than usual).
Pali Rohár Nov. 23, 2017, 9:03 a.m. UTC | #4
On Tuesday 14 November 2017 13:40:13 Wei Yongjun wrote:
> Fix to return error code -ENOMEM from the kzalloc() error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 549b4930f057 ("platform/x86: dell-smbios: Introduce dispatcher for SMM calls")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Looks good,

Reviewed-by: Pali Rohár <pali.rohar@gmai.com>

> ---
>  drivers/platform/x86/dell-laptop.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
> index c4903c5..0a8f359 100644
> --- a/drivers/platform/x86/dell-laptop.c
> +++ b/drivers/platform/x86/dell-laptop.c
> @@ -2081,8 +2081,10 @@ static int __init dell_init(void)
>  	}
>  
>  	buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL);
> -	if (!buffer)
> +	if (!buffer) {
> +		ret = -ENOMEM;
>  		goto fail_buffer;
> +	}
>  
>  	if (quirks && quirks->touchpad_led)
>  		touchpad_led_init(&platform_device->dev);
>
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index c4903c5..0a8f359 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -2081,8 +2081,10 @@  static int __init dell_init(void)
 	}
 
 	buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL);
-	if (!buffer)
+	if (!buffer) {
+		ret = -ENOMEM;
 		goto fail_buffer;
+	}
 
 	if (quirks && quirks->touchpad_led)
 		touchpad_led_init(&platform_device->dev);