* [PATCH] ALSA: core: Use common error handling code in two functions
@ 2017-08-22 19:12 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-22 19:12 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 22 Aug 2017 21:01:01 +0200
Add jump targets so that a bit of exception handling can be better reused
at the end of these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 30 ++++++++++++++++++------------
sound/core/timer.c | 10 ++++++----
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 89c7485519cb..048df9658f50 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
INIT_LIST_HEAD(&pcm->list);
if (id)
strlcpy(pcm->id, id, sizeof(pcm->id));
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ playback_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
+ if (err < 0)
+ goto free_pcm;
+
if (rpcm)
*rpcm = pcm;
return 0;
+
+free_pcm:
+ snd_pcm_free(pcm);
+ return err;
}
/**
diff --git a/sound/core/timer.c b/sound/core/timer.c
index a9b9a277e00c..6d73a63f6e2b 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system();
if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err);
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all();
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
snd_timer_proc_init();
return 0;
+
+put_timer:
+ put_device(&timer_dev);
+ return err;
}
static void __exit alsa_timer_exit(void)
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] ALSA: core: Use common error handling code in two functions
@ 2017-08-22 19:12 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-22 19:12 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 22 Aug 2017 21:01:01 +0200
Add jump targets so that a bit of exception handling can be better reused
at the end of these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 30 ++++++++++++++++++------------
sound/core/timer.c | 10 ++++++----
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 89c7485519cb..048df9658f50 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
INIT_LIST_HEAD(&pcm->list);
if (id)
strlcpy(pcm->id, id, sizeof(pcm->id));
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ playback_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
+ if (err < 0)
+ goto free_pcm;
+
if (rpcm)
*rpcm = pcm;
return 0;
+
+free_pcm:
+ snd_pcm_free(pcm);
+ return err;
}
/**
diff --git a/sound/core/timer.c b/sound/core/timer.c
index a9b9a277e00c..6d73a63f6e2b 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system();
if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err);
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all();
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
snd_timer_proc_init();
return 0;
+
+put_timer:
+ put_device(&timer_dev);
+ return err;
}
static void __exit alsa_timer_exit(void)
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] ALSA: core: Use common error handling code in two functions
@ 2017-08-22 19:12 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-22 19:12 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 22 Aug 2017 21:01:01 +0200
Add jump targets so that a bit of exception handling can be better reused
at the end of these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 30 ++++++++++++++++++------------
sound/core/timer.c | 10 ++++++----
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 89c7485519cb..048df9658f50 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
INIT_LIST_HEAD(&pcm->list);
if (id)
strlcpy(pcm->id, id, sizeof(pcm->id));
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ playback_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
+ if (err < 0)
+ goto free_pcm;
+
if (rpcm)
*rpcm = pcm;
return 0;
+
+free_pcm:
+ snd_pcm_free(pcm);
+ return err;
}
/**
diff --git a/sound/core/timer.c b/sound/core/timer.c
index a9b9a277e00c..6d73a63f6e2b 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system();
if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err);
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all();
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
snd_timer_proc_init();
return 0;
+
+put_timer:
+ put_device(&timer_dev);
+ return err;
}
static void __exit alsa_timer_exit(void)
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] ALSA: core: Use common error handling code in two functions
2017-08-22 19:12 ` SF Markus Elfring
(?)
@ 2017-08-23 5:16 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 5:16 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Ingo Molnar,
Dan Carpenter, Vegard Nossum, Jaroslav Kysela, Takashi Sakamoto,
kernel-janitors, LKML
On Tue, 22 Aug 2017 21:12:02 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 22 Aug 2017 21:01:01 +0200
>
> Add jump targets so that a bit of exception handling can be better reused
> at the end of these functions.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Please don't mix the changes for both PCM and timer.
Takashi
> ---
> sound/core/pcm.c | 30 ++++++++++++++++++------------
> sound/core/timer.c | 10 ++++++----
> 2 files changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 89c7485519cb..048df9658f50 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
> INIT_LIST_HEAD(&pcm->list);
> if (id)
> strlcpy(pcm->id, id, sizeof(pcm->id));
> - if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> - if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> - if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> +
> + err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
> + playback_count);
> + if (err < 0)
> + goto free_pcm;
> +
> + err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
> + if (err < 0)
> + goto free_pcm;
> +
> + err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
> + if (err < 0)
> + goto free_pcm;
> +
> if (rpcm)
> *rpcm = pcm;
> return 0;
> +
> +free_pcm:
> + snd_pcm_free(pcm);
> + return err;
> }
>
> /**
> diff --git a/sound/core/timer.c b/sound/core/timer.c
> index a9b9a277e00c..6d73a63f6e2b 100644
> --- a/sound/core/timer.c
> +++ b/sound/core/timer.c
> @@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
> err = snd_timer_register_system();
> if (err < 0) {
> pr_err("ALSA: unable to register system timer (%i)\n", err);
> - put_device(&timer_dev);
> - return err;
> + goto put_timer;
> }
>
> err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
> @@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
> if (err < 0) {
> pr_err("ALSA: unable to register timer device (%i)\n", err);
> snd_timer_free_all();
> - put_device(&timer_dev);
> - return err;
> + goto put_timer;
> }
>
> snd_timer_proc_init();
> return 0;
> +
> +put_timer:
> + put_device(&timer_dev);
> + return err;
> }
>
> static void __exit alsa_timer_exit(void)
> --
> 2.14.0
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] ALSA: core: Use common error handling code in two functions
@ 2017-08-23 5:16 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 5:16 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Vegard Nossum, Arnd Bergmann, kernel-janitors, LKML,
Arvind Yadav, Takashi Sakamoto, Ingo Molnar, Dan Carpenter
On Tue, 22 Aug 2017 21:12:02 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 22 Aug 2017 21:01:01 +0200
>
> Add jump targets so that a bit of exception handling can be better reused
> at the end of these functions.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Please don't mix the changes for both PCM and timer.
Takashi
> ---
> sound/core/pcm.c | 30 ++++++++++++++++++------------
> sound/core/timer.c | 10 ++++++----
> 2 files changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 89c7485519cb..048df9658f50 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
> INIT_LIST_HEAD(&pcm->list);
> if (id)
> strlcpy(pcm->id, id, sizeof(pcm->id));
> - if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> - if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> - if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> +
> + err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
> + playback_count);
> + if (err < 0)
> + goto free_pcm;
> +
> + err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
> + if (err < 0)
> + goto free_pcm;
> +
> + err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
> + if (err < 0)
> + goto free_pcm;
> +
> if (rpcm)
> *rpcm = pcm;
> return 0;
> +
> +free_pcm:
> + snd_pcm_free(pcm);
> + return err;
> }
>
> /**
> diff --git a/sound/core/timer.c b/sound/core/timer.c
> index a9b9a277e00c..6d73a63f6e2b 100644
> --- a/sound/core/timer.c
> +++ b/sound/core/timer.c
> @@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
> err = snd_timer_register_system();
> if (err < 0) {
> pr_err("ALSA: unable to register system timer (%i)\n", err);
> - put_device(&timer_dev);
> - return err;
> + goto put_timer;
> }
>
> err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
> @@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
> if (err < 0) {
> pr_err("ALSA: unable to register timer device (%i)\n", err);
> snd_timer_free_all();
> - put_device(&timer_dev);
> - return err;
> + goto put_timer;
> }
>
> snd_timer_proc_init();
> return 0;
> +
> +put_timer:
> + put_device(&timer_dev);
> + return err;
> }
>
> static void __exit alsa_timer_exit(void)
> --
> 2.14.0
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] ALSA: core: Use common error handling code in two functions
@ 2017-08-23 5:16 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 5:16 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Vegard Nossum, Arnd Bergmann, kernel-janitors, LKML,
Arvind Yadav, Takashi Sakamoto, Ingo Molnar, Dan Carpenter
On Tue, 22 Aug 2017 21:12:02 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 22 Aug 2017 21:01:01 +0200
>
> Add jump targets so that a bit of exception handling can be better reused
> at the end of these functions.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Please don't mix the changes for both PCM and timer.
Takashi
> ---
> sound/core/pcm.c | 30 ++++++++++++++++++------------
> sound/core/timer.c | 10 ++++++----
> 2 files changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 89c7485519cb..048df9658f50 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
> INIT_LIST_HEAD(&pcm->list);
> if (id)
> strlcpy(pcm->id, id, sizeof(pcm->id));
> - if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> - if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> - if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
> - snd_pcm_free(pcm);
> - return err;
> - }
> +
> + err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
> + playback_count);
> + if (err < 0)
> + goto free_pcm;
> +
> + err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
> + if (err < 0)
> + goto free_pcm;
> +
> + err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
> + if (err < 0)
> + goto free_pcm;
> +
> if (rpcm)
> *rpcm = pcm;
> return 0;
> +
> +free_pcm:
> + snd_pcm_free(pcm);
> + return err;
> }
>
> /**
> diff --git a/sound/core/timer.c b/sound/core/timer.c
> index a9b9a277e00c..6d73a63f6e2b 100644
> --- a/sound/core/timer.c
> +++ b/sound/core/timer.c
> @@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
> err = snd_timer_register_system();
> if (err < 0) {
> pr_err("ALSA: unable to register system timer (%i)\n", err);
> - put_device(&timer_dev);
> - return err;
> + goto put_timer;
> }
>
> err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
> @@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
> if (err < 0) {
> pr_err("ALSA: unable to register timer device (%i)\n", err);
> snd_timer_free_all();
> - put_device(&timer_dev);
> - return err;
> + goto put_timer;
> }
>
> snd_timer_proc_init();
> return 0;
> +
> +put_timer:
> + put_device(&timer_dev);
> + return err;
> }
>
> static void __exit alsa_timer_exit(void)
> --
> 2.14.0
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 0/6] ALSA: core: Fine-tuning for some function implementations
2017-08-23 5:16 ` Takashi Iwai
@ 2017-08-23 8:21 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:21 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 10:05:43 +0200
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (6):
pcm: Use common error handling code in _snd_pcm_new()
pcm: Adjust nine function calls together with a variable assignment
pcm: Adjust 11 checks for null pointers
timer: Use common error handling code in alsa_timer_init()
timer: Adjust a condition check in snd_timer_resolution()
timer: Adjust 13 checks for null pointers
sound/core/pcm.c | 90 +++++++++++++++++++++++++++++++-----------------------
sound/core/timer.c | 39 ++++++++++++-----------
2 files changed, 73 insertions(+), 56 deletions(-)
--
2.14.0
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 0/6] ALSA: core: Fine-tuning for some function implementations
@ 2017-08-23 8:21 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:21 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 10:05:43 +0200
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (6):
pcm: Use common error handling code in _snd_pcm_new()
pcm: Adjust nine function calls together with a variable assignment
pcm: Adjust 11 checks for null pointers
timer: Use common error handling code in alsa_timer_init()
timer: Adjust a condition check in snd_timer_resolution()
timer: Adjust 13 checks for null pointers
sound/core/pcm.c | 90 +++++++++++++++++++++++++++++++-----------------------
sound/core/timer.c | 39 ++++++++++++-----------
2 files changed, 73 insertions(+), 56 deletions(-)
--
2.14.0
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new()
2017-08-23 8:21 ` SF Markus Elfring
@ 2017-08-23 8:23 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:23 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 08:40:37 +0200
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 89c7485519cb..048df9658f50 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
INIT_LIST_HEAD(&pcm->list);
if (id)
strlcpy(pcm->id, id, sizeof(pcm->id));
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ playback_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
+ if (err < 0)
+ goto free_pcm;
+
if (rpcm)
*rpcm = pcm;
return 0;
+
+free_pcm:
+ snd_pcm_free(pcm);
+ return err;
}
/**
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new()
@ 2017-08-23 8:23 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:23 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 08:40:37 +0200
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 89c7485519cb..048df9658f50 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -783,21 +783,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
INIT_LIST_HEAD(&pcm->list);
if (id)
strlcpy(pcm->id, id, sizeof(pcm->id));
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
- if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
- snd_pcm_free(pcm);
- return err;
- }
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ playback_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
+ if (err < 0)
+ goto free_pcm;
+
if (rpcm)
*rpcm = pcm;
return 0;
+
+free_pcm:
+ snd_pcm_free(pcm);
+ return err;
}
/**
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment
2017-08-23 8:21 ` SF Markus Elfring
@ 2017-08-23 8:24 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:24 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:20:29 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 048df9658f50..c790f79e45ae 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -523,7 +523,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
sprintf(name, "pcm%i%c", pcm->device,
pstr->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c');
- if ((entry = snd_info_create_card_entry(pcm->card, name, pcm->card->proc_root)) == NULL)
+ entry = snd_info_create_card_entry(pcm->card, name,
+ pcm->card->proc_root);
+ if (!entry)
return -ENOMEM;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) {
@@ -531,8 +533,8 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
return -ENOMEM;
}
pstr->proc_root = entry;
-
- if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
@@ -542,8 +544,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
pstr->proc_info_entry = entry;
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
- if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
- pstr->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
+ pstr->proc_root);
+ if (entry) {
entry->c.text.read = snd_pcm_xrun_debug_read;
entry->c.text.write = snd_pcm_xrun_debug_write;
entry->mode |= S_IWUSR;
@@ -580,7 +583,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
card = substream->pcm->card;
sprintf(name, "sub%i", substream->number);
- if ((entry = snd_info_create_card_entry(card, name, substream->pstr->proc_root)) == NULL)
+ entry = snd_info_create_card_entry(card, name,
+ substream->pstr->proc_root);
+ if (!entry)
return -ENOMEM;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) {
@@ -588,8 +593,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
return -ENOMEM;
}
substream->proc_root = entry;
-
- if ((entry = snd_info_create_card_entry(card, "info", substream->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(card, "info", substream->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_info_read);
if (snd_info_register(entry) < 0) {
@@ -598,8 +603,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
}
}
substream->proc_info_entry = entry;
-
- if ((entry = snd_info_create_card_entry(card, "hw_params", substream->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(card, "hw_params",
+ substream->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_hw_params_read);
if (snd_info_register(entry) < 0) {
@@ -608,8 +614,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
}
}
substream->proc_hw_params_entry = entry;
-
- if ((entry = snd_info_create_card_entry(card, "sw_params", substream->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(card, "sw_params",
+ substream->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_sw_params_read);
if (snd_info_register(entry) < 0) {
@@ -618,8 +625,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
}
}
substream->proc_sw_params_entry = entry;
-
- if ((entry = snd_info_create_card_entry(card, "status", substream->proc_root)) != NULL) {
+ entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_status_read);
if (snd_info_register(entry) < 0) {
@@ -1230,7 +1237,8 @@ static void snd_pcm_proc_init(void)
{
struct snd_info_entry *entry;
- if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
+ entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);
+ if (entry) {
snd_info_set_text_ops(entry, NULL, snd_pcm_proc_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment
@ 2017-08-23 8:24 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:24 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:20:29 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 048df9658f50..c790f79e45ae 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -523,7 +523,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
sprintf(name, "pcm%i%c", pcm->device,
pstr->stream = SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c');
- if ((entry = snd_info_create_card_entry(pcm->card, name, pcm->card->proc_root)) = NULL)
+ entry = snd_info_create_card_entry(pcm->card, name,
+ pcm->card->proc_root);
+ if (!entry)
return -ENOMEM;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) {
@@ -531,8 +533,8 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
return -ENOMEM;
}
pstr->proc_root = entry;
-
- if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
@@ -542,8 +544,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
pstr->proc_info_entry = entry;
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
- if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
- pstr->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
+ pstr->proc_root);
+ if (entry) {
entry->c.text.read = snd_pcm_xrun_debug_read;
entry->c.text.write = snd_pcm_xrun_debug_write;
entry->mode |= S_IWUSR;
@@ -580,7 +583,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
card = substream->pcm->card;
sprintf(name, "sub%i", substream->number);
- if ((entry = snd_info_create_card_entry(card, name, substream->pstr->proc_root)) = NULL)
+ entry = snd_info_create_card_entry(card, name,
+ substream->pstr->proc_root);
+ if (!entry)
return -ENOMEM;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) {
@@ -588,8 +593,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
return -ENOMEM;
}
substream->proc_root = entry;
-
- if ((entry = snd_info_create_card_entry(card, "info", substream->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(card, "info", substream->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_info_read);
if (snd_info_register(entry) < 0) {
@@ -598,8 +603,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
}
}
substream->proc_info_entry = entry;
-
- if ((entry = snd_info_create_card_entry(card, "hw_params", substream->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(card, "hw_params",
+ substream->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_hw_params_read);
if (snd_info_register(entry) < 0) {
@@ -608,8 +614,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
}
}
substream->proc_hw_params_entry = entry;
-
- if ((entry = snd_info_create_card_entry(card, "sw_params", substream->proc_root)) != NULL) {
+ entry = snd_info_create_card_entry(card, "sw_params",
+ substream->proc_root);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_sw_params_read);
if (snd_info_register(entry) < 0) {
@@ -618,8 +625,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
}
}
substream->proc_sw_params_entry = entry;
-
- if ((entry = snd_info_create_card_entry(card, "status", substream->proc_root)) != NULL) {
+ entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);
+ if (entry) {
snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_status_read);
if (snd_info_register(entry) < 0) {
@@ -1230,7 +1237,8 @@ static void snd_pcm_proc_init(void)
{
struct snd_info_entry *entry;
- if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
+ entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);
+ if (entry) {
snd_info_set_text_ops(entry, NULL, snd_pcm_proc_read);
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers
2017-08-23 8:21 ` SF Markus Elfring
(?)
@ 2017-08-23 8:25 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:25 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:28:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index c790f79e45ae..24047a07dc7f 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -132,7 +132,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
return -EFAULT;
mutex_lock(®ister_mutex);
pcm = snd_pcm_get(card, device);
- if (pcm == NULL) {
+ if (!pcm) {
err = -ENXIO;
goto _error;
}
@@ -149,7 +149,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
substream = substream->next)
if (substream->number == (int)subdevice)
break;
- if (substream == NULL) {
+ if (!substream) {
err = -ENXIO;
goto _error;
}
@@ -733,7 +733,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
substream->stream = stream;
sprintf(substream->name, "subdevice #%i", idx);
substream->buffer_bytes_max = UINT_MAX;
- if (prev == NULL)
+ if (!prev)
pstr->substream = substream;
else
prev->next = substream;
@@ -743,7 +743,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
if (err < 0) {
pcm_err(pcm,
"Error in snd_pcm_stream_proc_init\n");
- if (prev == NULL)
+ if (!prev)
pstr->substream = NULL;
else
prev->next = NULL;
@@ -951,7 +951,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
return -EINVAL;
*rsubstream = NULL;
pstr = &pcm->streams[stream];
- if (pstr->substream == NULL || pstr->substream_count == 0)
+ if (!pstr->substream || pstr->substream_count == 0)
return -ENODEV;
card = pcm->card;
@@ -993,16 +993,16 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
substream->number == prefer_subdevice))
break;
}
- if (substream == NULL)
+ if (!substream)
return -EAGAIN;
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
- if (runtime == NULL)
+ if (!runtime)
return -ENOMEM;
size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status));
runtime->status = snd_malloc_pages(size, GFP_KERNEL);
- if (runtime->status == NULL) {
+ if (!runtime->status) {
kfree(runtime);
return -ENOMEM;
}
@@ -1010,7 +1010,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control));
runtime->control = snd_malloc_pages(size, GFP_KERNEL);
- if (runtime->control == NULL) {
+ if (!runtime->control) {
snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
kfree(runtime);
@@ -1040,7 +1040,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
if (PCM_RUNTIME_CHECK(substream))
return;
runtime = substream->runtime;
- if (runtime->private_free != NULL)
+ if (runtime->private_free)
runtime->private_free(runtime);
snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
@@ -1107,7 +1107,7 @@ static int snd_pcm_dev_register(struct snd_device *device)
goto unlock;
for (cidx = 0; cidx < 2; cidx++) {
int devtype = -1;
- if (pcm->streams[cidx].substream == NULL)
+ if (!pcm->streams[cidx].substream)
continue;
switch (cidx) {
case SNDRV_PCM_STREAM_PLAYBACK:
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers
@ 2017-08-23 8:25 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:25 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:28:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index c790f79e45ae..24047a07dc7f 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -132,7 +132,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
return -EFAULT;
mutex_lock(®ister_mutex);
pcm = snd_pcm_get(card, device);
- if (pcm = NULL) {
+ if (!pcm) {
err = -ENXIO;
goto _error;
}
@@ -149,7 +149,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
substream = substream->next)
if (substream->number = (int)subdevice)
break;
- if (substream = NULL) {
+ if (!substream) {
err = -ENXIO;
goto _error;
}
@@ -733,7 +733,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
substream->stream = stream;
sprintf(substream->name, "subdevice #%i", idx);
substream->buffer_bytes_max = UINT_MAX;
- if (prev = NULL)
+ if (!prev)
pstr->substream = substream;
else
prev->next = substream;
@@ -743,7 +743,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
if (err < 0) {
pcm_err(pcm,
"Error in snd_pcm_stream_proc_init\n");
- if (prev = NULL)
+ if (!prev)
pstr->substream = NULL;
else
prev->next = NULL;
@@ -951,7 +951,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
return -EINVAL;
*rsubstream = NULL;
pstr = &pcm->streams[stream];
- if (pstr->substream = NULL || pstr->substream_count = 0)
+ if (!pstr->substream || pstr->substream_count = 0)
return -ENODEV;
card = pcm->card;
@@ -993,16 +993,16 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
substream->number = prefer_subdevice))
break;
}
- if (substream = NULL)
+ if (!substream)
return -EAGAIN;
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
- if (runtime = NULL)
+ if (!runtime)
return -ENOMEM;
size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status));
runtime->status = snd_malloc_pages(size, GFP_KERNEL);
- if (runtime->status = NULL) {
+ if (!runtime->status) {
kfree(runtime);
return -ENOMEM;
}
@@ -1010,7 +1010,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control));
runtime->control = snd_malloc_pages(size, GFP_KERNEL);
- if (runtime->control = NULL) {
+ if (!runtime->control) {
snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
kfree(runtime);
@@ -1040,7 +1040,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
if (PCM_RUNTIME_CHECK(substream))
return;
runtime = substream->runtime;
- if (runtime->private_free != NULL)
+ if (runtime->private_free)
runtime->private_free(runtime);
snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
@@ -1107,7 +1107,7 @@ static int snd_pcm_dev_register(struct snd_device *device)
goto unlock;
for (cidx = 0; cidx < 2; cidx++) {
int devtype = -1;
- if (pcm->streams[cidx].substream = NULL)
+ if (!pcm->streams[cidx].substream)
continue;
switch (cidx) {
case SNDRV_PCM_STREAM_PLAYBACK:
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers
@ 2017-08-23 8:25 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:25 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:28:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/pcm.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index c790f79e45ae..24047a07dc7f 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -132,7 +132,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
return -EFAULT;
mutex_lock(®ister_mutex);
pcm = snd_pcm_get(card, device);
- if (pcm == NULL) {
+ if (!pcm) {
err = -ENXIO;
goto _error;
}
@@ -149,7 +149,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
substream = substream->next)
if (substream->number == (int)subdevice)
break;
- if (substream == NULL) {
+ if (!substream) {
err = -ENXIO;
goto _error;
}
@@ -733,7 +733,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
substream->stream = stream;
sprintf(substream->name, "subdevice #%i", idx);
substream->buffer_bytes_max = UINT_MAX;
- if (prev == NULL)
+ if (!prev)
pstr->substream = substream;
else
prev->next = substream;
@@ -743,7 +743,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
if (err < 0) {
pcm_err(pcm,
"Error in snd_pcm_stream_proc_init\n");
- if (prev == NULL)
+ if (!prev)
pstr->substream = NULL;
else
prev->next = NULL;
@@ -951,7 +951,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
return -EINVAL;
*rsubstream = NULL;
pstr = &pcm->streams[stream];
- if (pstr->substream == NULL || pstr->substream_count == 0)
+ if (!pstr->substream || pstr->substream_count == 0)
return -ENODEV;
card = pcm->card;
@@ -993,16 +993,16 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
substream->number == prefer_subdevice))
break;
}
- if (substream == NULL)
+ if (!substream)
return -EAGAIN;
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
- if (runtime == NULL)
+ if (!runtime)
return -ENOMEM;
size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status));
runtime->status = snd_malloc_pages(size, GFP_KERNEL);
- if (runtime->status == NULL) {
+ if (!runtime->status) {
kfree(runtime);
return -ENOMEM;
}
@@ -1010,7 +1010,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control));
runtime->control = snd_malloc_pages(size, GFP_KERNEL);
- if (runtime->control == NULL) {
+ if (!runtime->control) {
snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
kfree(runtime);
@@ -1040,7 +1040,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
if (PCM_RUNTIME_CHECK(substream))
return;
runtime = substream->runtime;
- if (runtime->private_free != NULL)
+ if (runtime->private_free)
runtime->private_free(runtime);
snd_free_pages((void*)runtime->status,
PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
@@ -1107,7 +1107,7 @@ static int snd_pcm_dev_register(struct snd_device *device)
goto unlock;
for (cidx = 0; cidx < 2; cidx++) {
int devtype = -1;
- if (pcm->streams[cidx].substream == NULL)
+ if (!pcm->streams[cidx].substream)
continue;
switch (cidx) {
case SNDRV_PCM_STREAM_PLAYBACK:
--
2.14.0
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init()
2017-08-23 8:21 ` SF Markus Elfring
@ 2017-08-23 8:27 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:27 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:30:41 +0200
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index a9b9a277e00c..6d73a63f6e2b 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system();
if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err);
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all();
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
snd_timer_proc_init();
return 0;
+
+put_timer:
+ put_device(&timer_dev);
+ return err;
}
static void __exit alsa_timer_exit(void)
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init()
@ 2017-08-23 8:27 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:27 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:30:41 +0200
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index a9b9a277e00c..6d73a63f6e2b 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -2096,8 +2096,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system();
if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err);
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@@ -2105,12 +2104,15 @@ static int __init alsa_timer_init(void)
if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all();
- put_device(&timer_dev);
- return err;
+ goto put_timer;
}
snd_timer_proc_init();
return 0;
+
+put_timer:
+ put_device(&timer_dev);
+ return err;
}
static void __exit alsa_timer_exit(void)
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution()
2017-08-23 8:21 ` SF Markus Elfring
@ 2017-08-23 8:28 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:28 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:45:06 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code place.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 6d73a63f6e2b..6cdd04a45962 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -395,5 +395,6 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
return 0;
- if ((timer = timeri->timer) != NULL) {
+ timer = timeri->timer;
+ if (timer) {
if (timer->hw.c_resolution)
return timer->hw.c_resolution(timer);
return timer->hw.resolution;
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution()
@ 2017-08-23 8:28 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:28 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:45:06 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code place.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 6d73a63f6e2b..6cdd04a45962 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -395,5 +395,6 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
return 0;
- if ((timer = timeri->timer) != NULL) {
+ timer = timeri->timer;
+ if (timer) {
if (timer->hw.c_resolution)
return timer->hw.c_resolution(timer);
return timer->hw.resolution;
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers
2017-08-23 8:21 ` SF Markus Elfring
(?)
@ 2017-08-23 8:29 ` SF Markus Elfring
-1 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:29 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:54:42 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 6cdd04a45962..ff94842f7b01 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -106,7 +106,7 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner,
{
struct snd_timer_instance *timeri;
timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
- if (timeri == NULL)
+ if (!timeri)
return NULL;
timeri->owner = kstrdup(owner, GFP_KERNEL);
if (! timeri->owner) {
@@ -141,7 +141,7 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
continue;
if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD ||
timer->tmr_class == SNDRV_TIMER_CLASS_PCM) &&
- (timer->card == NULL ||
+ (!timer->card ||
timer->card->number != tid->card))
continue;
if (timer->tmr_device != tid->device)
@@ -391,5 +391,5 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
{
struct snd_timer * timer;
- if (timeri == NULL)
+ if (!timeri)
return 0;
@@ -425,7 +425,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
if (ti->flags & SNDRV_TIMER_IFLG_SLAVE)
return;
timer = ti->timer;
- if (timer == NULL)
+ if (!timer)
return;
if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
return;
@@ -586,7 +586,7 @@ static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop)
*/
int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)
{
- if (timeri == NULL || ticks < 1)
+ if (!timeri || ticks < 1)
return -EINVAL;
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE)
return snd_timer_start_slave(timeri, true);
@@ -722,7 +722,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
unsigned long flags;
int use_tasklet = 0;
- if (timer == NULL)
+ if (!timer)
return;
if (timer->card && timer->card->shutdown)
@@ -856,7 +856,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
spin_lock_init(&timer->lock);
tasklet_init(&timer->task_queue, snd_timer_tasklet,
(unsigned long)timer);
- if (card != NULL) {
+ if (card) {
timer->module = card->module;
err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops);
if (err < 0) {
@@ -909,7 +909,7 @@ static int snd_timer_dev_register(struct snd_device *dev)
if (snd_BUG_ON(!timer || !timer->hw.start || !timer->hw.stop))
return -ENXIO;
if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) &&
- !timer->hw.resolution && timer->hw.c_resolution == NULL)
+ !timer->hw.resolution && !timer->hw.c_resolution)
return -EINVAL;
mutex_lock(®ister_mutex);
@@ -1114,7 +1114,7 @@ static int snd_timer_register_system(void)
strcpy(timer->name, "system timer");
timer->hw = snd_timer_system;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (priv == NULL) {
+ if (!priv) {
snd_timer_free(timer);
return -ENOMEM;
}
@@ -1182,7 +1182,7 @@ static void __init snd_timer_proc_init(void)
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
- if (entry != NULL) {
+ if (entry) {
entry->c.text.read = snd_timer_proc_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
@@ -1378,7 +1378,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
return err;
tu = kzalloc(sizeof(*tu), GFP_KERNEL);
- if (tu == NULL)
+ if (!tu)
return -ENOMEM;
spin_lock_init(&tu->qlock);
init_waitqueue_head(&tu->qchange_sleep);
@@ -1537,7 +1537,7 @@ static int snd_timer_user_ginfo(struct file *file,
ginfo->tid = tid;
mutex_lock(®ister_mutex);
t = snd_timer_find(&tid);
- if (t != NULL) {
+ if (t) {
ginfo->card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
ginfo->flags |= SNDRV_TIMER_FLG_SLAVE;
@@ -1611,7 +1611,7 @@ static int snd_timer_user_gstatus(struct file *file,
gstatus.tid = tid;
mutex_lock(®ister_mutex);
t = snd_timer_find(&tid);
- if (t != NULL) {
+ if (t) {
if (t->hw.c_resolution)
gstatus.resolution = t->hw.c_resolution(t);
else
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers
@ 2017-08-23 8:29 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:29 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:54:42 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 6cdd04a45962..ff94842f7b01 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -106,7 +106,7 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner,
{
struct snd_timer_instance *timeri;
timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
- if (timeri = NULL)
+ if (!timeri)
return NULL;
timeri->owner = kstrdup(owner, GFP_KERNEL);
if (! timeri->owner) {
@@ -141,7 +141,7 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
continue;
if ((timer->tmr_class = SNDRV_TIMER_CLASS_CARD ||
timer->tmr_class = SNDRV_TIMER_CLASS_PCM) &&
- (timer->card = NULL ||
+ (!timer->card ||
timer->card->number != tid->card))
continue;
if (timer->tmr_device != tid->device)
@@ -391,5 +391,5 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
{
struct snd_timer * timer;
- if (timeri = NULL)
+ if (!timeri)
return 0;
@@ -425,7 +425,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
if (ti->flags & SNDRV_TIMER_IFLG_SLAVE)
return;
timer = ti->timer;
- if (timer = NULL)
+ if (!timer)
return;
if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
return;
@@ -586,7 +586,7 @@ static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop)
*/
int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)
{
- if (timeri = NULL || ticks < 1)
+ if (!timeri || ticks < 1)
return -EINVAL;
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE)
return snd_timer_start_slave(timeri, true);
@@ -722,7 +722,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
unsigned long flags;
int use_tasklet = 0;
- if (timer = NULL)
+ if (!timer)
return;
if (timer->card && timer->card->shutdown)
@@ -856,7 +856,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
spin_lock_init(&timer->lock);
tasklet_init(&timer->task_queue, snd_timer_tasklet,
(unsigned long)timer);
- if (card != NULL) {
+ if (card) {
timer->module = card->module;
err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops);
if (err < 0) {
@@ -909,7 +909,7 @@ static int snd_timer_dev_register(struct snd_device *dev)
if (snd_BUG_ON(!timer || !timer->hw.start || !timer->hw.stop))
return -ENXIO;
if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) &&
- !timer->hw.resolution && timer->hw.c_resolution = NULL)
+ !timer->hw.resolution && !timer->hw.c_resolution)
return -EINVAL;
mutex_lock(®ister_mutex);
@@ -1114,7 +1114,7 @@ static int snd_timer_register_system(void)
strcpy(timer->name, "system timer");
timer->hw = snd_timer_system;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (priv = NULL) {
+ if (!priv) {
snd_timer_free(timer);
return -ENOMEM;
}
@@ -1182,7 +1182,7 @@ static void __init snd_timer_proc_init(void)
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
- if (entry != NULL) {
+ if (entry) {
entry->c.text.read = snd_timer_proc_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
@@ -1378,7 +1378,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
return err;
tu = kzalloc(sizeof(*tu), GFP_KERNEL);
- if (tu = NULL)
+ if (!tu)
return -ENOMEM;
spin_lock_init(&tu->qlock);
init_waitqueue_head(&tu->qchange_sleep);
@@ -1537,7 +1537,7 @@ static int snd_timer_user_ginfo(struct file *file,
ginfo->tid = tid;
mutex_lock(®ister_mutex);
t = snd_timer_find(&tid);
- if (t != NULL) {
+ if (t) {
ginfo->card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
ginfo->flags |= SNDRV_TIMER_FLG_SLAVE;
@@ -1611,7 +1611,7 @@ static int snd_timer_user_gstatus(struct file *file,
gstatus.tid = tid;
mutex_lock(®ister_mutex);
t = snd_timer_find(&tid);
- if (t != NULL) {
+ if (t) {
if (t->hw.c_resolution)
gstatus.resolution = t->hw.c_resolution(t);
else
--
2.14.0
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers
@ 2017-08-23 8:29 ` SF Markus Elfring
0 siblings, 0 replies; 36+ messages in thread
From: SF Markus Elfring @ 2017-08-23 8:29 UTC (permalink / raw)
To: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Iwai, Takashi Sakamoto,
Vegard Nossum
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Aug 2017 09:54:42 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/core/timer.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 6cdd04a45962..ff94842f7b01 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -106,7 +106,7 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner,
{
struct snd_timer_instance *timeri;
timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
- if (timeri == NULL)
+ if (!timeri)
return NULL;
timeri->owner = kstrdup(owner, GFP_KERNEL);
if (! timeri->owner) {
@@ -141,7 +141,7 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
continue;
if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD ||
timer->tmr_class == SNDRV_TIMER_CLASS_PCM) &&
- (timer->card == NULL ||
+ (!timer->card ||
timer->card->number != tid->card))
continue;
if (timer->tmr_device != tid->device)
@@ -391,5 +391,5 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
{
struct snd_timer * timer;
- if (timeri == NULL)
+ if (!timeri)
return 0;
@@ -425,7 +425,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
if (ti->flags & SNDRV_TIMER_IFLG_SLAVE)
return;
timer = ti->timer;
- if (timer == NULL)
+ if (!timer)
return;
if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
return;
@@ -586,7 +586,7 @@ static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop)
*/
int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks)
{
- if (timeri == NULL || ticks < 1)
+ if (!timeri || ticks < 1)
return -EINVAL;
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE)
return snd_timer_start_slave(timeri, true);
@@ -722,7 +722,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
unsigned long flags;
int use_tasklet = 0;
- if (timer == NULL)
+ if (!timer)
return;
if (timer->card && timer->card->shutdown)
@@ -856,7 +856,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
spin_lock_init(&timer->lock);
tasklet_init(&timer->task_queue, snd_timer_tasklet,
(unsigned long)timer);
- if (card != NULL) {
+ if (card) {
timer->module = card->module;
err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops);
if (err < 0) {
@@ -909,7 +909,7 @@ static int snd_timer_dev_register(struct snd_device *dev)
if (snd_BUG_ON(!timer || !timer->hw.start || !timer->hw.stop))
return -ENXIO;
if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) &&
- !timer->hw.resolution && timer->hw.c_resolution == NULL)
+ !timer->hw.resolution && !timer->hw.c_resolution)
return -EINVAL;
mutex_lock(®ister_mutex);
@@ -1114,7 +1114,7 @@ static int snd_timer_register_system(void)
strcpy(timer->name, "system timer");
timer->hw = snd_timer_system;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (priv == NULL) {
+ if (!priv) {
snd_timer_free(timer);
return -ENOMEM;
}
@@ -1182,7 +1182,7 @@ static void __init snd_timer_proc_init(void)
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL);
- if (entry != NULL) {
+ if (entry) {
entry->c.text.read = snd_timer_proc_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
@@ -1378,7 +1378,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
return err;
tu = kzalloc(sizeof(*tu), GFP_KERNEL);
- if (tu == NULL)
+ if (!tu)
return -ENOMEM;
spin_lock_init(&tu->qlock);
init_waitqueue_head(&tu->qchange_sleep);
@@ -1537,7 +1537,7 @@ static int snd_timer_user_ginfo(struct file *file,
ginfo->tid = tid;
mutex_lock(®ister_mutex);
t = snd_timer_find(&tid);
- if (t != NULL) {
+ if (t) {
ginfo->card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
ginfo->flags |= SNDRV_TIMER_FLG_SLAVE;
@@ -1611,7 +1611,7 @@ static int snd_timer_user_gstatus(struct file *file,
gstatus.tid = tid;
mutex_lock(®ister_mutex);
t = snd_timer_find(&tid);
- if (t != NULL) {
+ if (t) {
if (t->hw.c_resolution)
gstatus.resolution = t->hw.c_resolution(t);
else
--
2.14.0
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers
2017-08-23 8:25 ` SF Markus Elfring
@ 2017-08-23 8:35 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:25:49 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:28:00 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Converting only these alone doesn't give any big merit. Another patch
in the series fixed the style if ((err = xxx)), so it's fine, though.
checkpatch is no bible, after all.
thanks,
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers
@ 2017-08-23 8:35 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:25:49 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:28:00 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Converting only these alone doesn't give any big merit. Another patch
in the series fixed the style if ((err = xxx)), so it's fine, though.
checkpatch is no bible, after all.
thanks,
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new()
2017-08-23 8:23 ` SF Markus Elfring
(?)
@ 2017-08-23 8:36 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:36 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:23:23 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 08:40:37 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new()
@ 2017-08-23 8:36 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:36 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Vegard Nossum, Arnd Bergmann, kernel-janitors, LKML,
Arvind Yadav, Takashi Sakamoto, Ingo Molnar, Dan Carpenter
On Wed, 23 Aug 2017 10:23:23 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 08:40:37 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new()
@ 2017-08-23 8:36 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:36 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Vegard Nossum, Arnd Bergmann, kernel-janitors, LKML,
Arvind Yadav, Takashi Sakamoto, Ingo Molnar, Dan Carpenter
On Wed, 23 Aug 2017 10:23:23 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 08:40:37 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment
2017-08-23 8:24 ` SF Markus Elfring
@ 2017-08-23 8:36 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:36 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:24:34 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:20:29 +0200
>
> The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment
@ 2017-08-23 8:36 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:36 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:24:34 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:20:29 +0200
>
> The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution()
2017-08-23 8:28 ` SF Markus Elfring
@ 2017-08-23 8:37 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:37 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:28:41 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:45:06 +0200
>
> The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix the affected source code place.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution()
@ 2017-08-23 8:37 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:37 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:28:41 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:45:06 +0200
>
> The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix the affected source code place.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers
2017-08-23 8:29 ` SF Markus Elfring
@ 2017-08-23 8:38 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:38 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:29:52 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:54:42 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
I won't apply this either for the same reason as patch 3.
thanks,
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers
@ 2017-08-23 8:38 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:38 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:29:52 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:54:42 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
I won't apply this either for the same reason as patch 3.
thanks,
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init()
2017-08-23 8:27 ` SF Markus Elfring
(?)
@ 2017-08-23 8:39 ` Takashi Iwai
-1 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:39 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Arnd Bergmann, Arvind Yadav, Dan Carpenter,
Ingo Molnar, Jaroslav Kysela, Takashi Sakamoto, Vegard Nossum,
kernel-janitors, LKML
On Wed, 23 Aug 2017 10:27:14 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:30:41 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init()
@ 2017-08-23 8:39 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:39 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Vegard Nossum, Arnd Bergmann, kernel-janitors, LKML,
Arvind Yadav, Takashi Sakamoto, Ingo Molnar, Dan Carpenter
On Wed, 23 Aug 2017 10:27:14 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:30:41 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init()
@ 2017-08-23 8:39 ` Takashi Iwai
0 siblings, 0 replies; 36+ messages in thread
From: Takashi Iwai @ 2017-08-23 8:39 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Vegard Nossum, Arnd Bergmann, kernel-janitors, LKML,
Arvind Yadav, Takashi Sakamoto, Ingo Molnar, Dan Carpenter
On Wed, 23 Aug 2017 10:27:14 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 23 Aug 2017 09:30:41 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2017-08-23 8:39 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 19:12 [PATCH] ALSA: core: Use common error handling code in two functions SF Markus Elfring
2017-08-22 19:12 ` SF Markus Elfring
2017-08-22 19:12 ` SF Markus Elfring
2017-08-23 5:16 ` Takashi Iwai
2017-08-23 5:16 ` Takashi Iwai
2017-08-23 5:16 ` Takashi Iwai
2017-08-23 8:21 ` [PATCH 0/6] ALSA: core: Fine-tuning for some function implementations SF Markus Elfring
2017-08-23 8:21 ` SF Markus Elfring
2017-08-23 8:23 ` [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new() SF Markus Elfring
2017-08-23 8:23 ` SF Markus Elfring
2017-08-23 8:36 ` Takashi Iwai
2017-08-23 8:36 ` Takashi Iwai
2017-08-23 8:36 ` Takashi Iwai
2017-08-23 8:24 ` [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment SF Markus Elfring
2017-08-23 8:24 ` SF Markus Elfring
2017-08-23 8:36 ` Takashi Iwai
2017-08-23 8:36 ` Takashi Iwai
2017-08-23 8:25 ` [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers SF Markus Elfring
2017-08-23 8:25 ` SF Markus Elfring
2017-08-23 8:25 ` SF Markus Elfring
2017-08-23 8:35 ` Takashi Iwai
2017-08-23 8:35 ` Takashi Iwai
2017-08-23 8:27 ` [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init() SF Markus Elfring
2017-08-23 8:27 ` SF Markus Elfring
2017-08-23 8:39 ` Takashi Iwai
2017-08-23 8:39 ` Takashi Iwai
2017-08-23 8:39 ` Takashi Iwai
2017-08-23 8:28 ` [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution() SF Markus Elfring
2017-08-23 8:28 ` SF Markus Elfring
2017-08-23 8:37 ` Takashi Iwai
2017-08-23 8:37 ` Takashi Iwai
2017-08-23 8:29 ` [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers SF Markus Elfring
2017-08-23 8:29 ` SF Markus Elfring
2017-08-23 8:29 ` SF Markus Elfring
2017-08-23 8:38 ` Takashi Iwai
2017-08-23 8:38 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.