2013-06-18 13:09:45

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH] ALSA: firewire: fix error return code in scs_probe()

From: Wei Yongjun <[email protected]>

Fix to return -ENOMEM in the kmalloc() error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <[email protected]>
---
sound/firewire/scs1x.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c
index 844a555..b252c21 100644
--- a/sound/firewire/scs1x.c
+++ b/sound/firewire/scs1x.c
@@ -405,8 +405,10 @@ static int scs_probe(struct device *unit_dev)
scs->output_idle = true;

scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL);
- if (!scs->buffer)
+ if (!scs->buffer) {
+ err = -ENOMEM;
goto err_card;
+ }

scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE;
scs->hss_handler.address_callback = handle_hss;


2013-06-18 14:14:53

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] ALSA: firewire: fix error return code in scs_probe()

Wei Yongjun wrote:
> Fix to return -ENOMEM in the kmalloc() error handling
> case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <[email protected]>

Acked-by: Clemens Ladisch <[email protected]>

> scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL);
> - if (!scs->buffer)
> + if (!scs->buffer) {
> + err = -ENOMEM;
> goto err_card;
> + }

2013-06-18 14:17:06

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH] ALSA: firewire: fix error return code in scs_probe()

At Tue, 18 Jun 2013 21:09:42 +0800,
Wei Yongjun wrote:
>
> From: Wei Yongjun <[email protected]>
>
> Fix to return -ENOMEM in the kmalloc() error handling
> case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <[email protected]>

Thanks, applied with ack by Clemens.


Takashi

> ---
> sound/firewire/scs1x.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c
> index 844a555..b252c21 100644
> --- a/sound/firewire/scs1x.c
> +++ b/sound/firewire/scs1x.c
> @@ -405,8 +405,10 @@ static int scs_probe(struct device *unit_dev)
> scs->output_idle = true;
>
> scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL);
> - if (!scs->buffer)
> + if (!scs->buffer) {
> + err = -ENOMEM;
> goto err_card;
> + }
>
> scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE;
> scs->hss_handler.address_callback = handle_hss;
>