Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1718141
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment |
| Date | 2017-08-23 10:30 +0200 |
| Message-ID | <uhzd0-6Ct-29@gated-at.bofh.it> (permalink) |
| References | <uhmSw-6HP-59@gated-at.bofh.it> <uhwf7-4Nc-1@gated-at.bofh.it> <uhzd0-6Ct-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] ALSA: core: Use common error handling code in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-22 21:20 +0200
Re: [PATCH] ALSA: core: Use common error handling code in two functions Takashi Iwai <tiwai@suse.de> - 2017-08-23 07:20 +0200
[PATCH 0/6] ALSA: core: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:30 +0200
[PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:30 +0200
Re: [PATCH 3/6] ALSA: pcm: Adjust 11 checks for null pointers Takashi Iwai <tiwai@suse.de> - 2017-08-23 10:40 +0200
[PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:30 +0200
Re: [PATCH 2/6] ALSA: pcm: Adjust nine function calls together with a variable assignment Takashi Iwai <tiwai@suse.de> - 2017-08-23 10:40 +0200
[PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:30 +0200
Re: [PATCH 1/6] ALSA: pcm: Use common error handling code in _snd_pcm_new() Takashi Iwai <tiwai@suse.de> - 2017-08-23 10:40 +0200
[PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:30 +0200
Re: [PATCH 4/6] ALSA: timer: Use common error handling code in alsa_timer_init() Takashi Iwai <tiwai@suse.de> - 2017-08-23 10:40 +0200
[PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:30 +0200
Re: [PATCH 5/6] ALSA: timer: Adjust a condition check in snd_timer_resolution() Takashi Iwai <tiwai@suse.de> - 2017-08-23 10:40 +0200
[PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-23 10:40 +0200
Re: [PATCH 6/6] ALSA: timer: Adjust 13 checks for null pointers Takashi Iwai <tiwai@suse.de> - 2017-08-23 10:40 +0200
csiph-web