linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: seq: replace ternary operator with max()
@ 2022-05-17  6:25 Guo Zhengkui
  2022-05-17  6:50 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Guo Zhengkui @ 2022-05-17  6:25 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Guo Zhengkui,
	moderated list:SOUND, open list
  Cc: zhengkui_guo

Fix the following coccicheck warning:

sound/core/seq/seq_ports.c:142:12-14: WARNING opportunity for max()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 sound/core/seq/seq_ports.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index 84d78630463e..25fcf5a2c71c 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -139,7 +139,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
 	port_subs_info_init(&new_port->c_dest);
 	snd_use_lock_use(&new_port->use_lock);
 
-	num = port >= 0 ? port : 0;
+	num = max(port, 0);
 	mutex_lock(&client->ports_mutex);
 	write_lock_irq(&client->ports_lock);
 	list_for_each_entry(p, &client->ports_list_head, list) {
-- 
2.20.1


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

* Re: [PATCH] ALSA: seq: replace ternary operator with max()
  2022-05-17  6:25 [PATCH] ALSA: seq: replace ternary operator with max() Guo Zhengkui
@ 2022-05-17  6:50 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2022-05-17  6:50 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Jaroslav Kysela, Takashi Iwai, moderated list:SOUND, open list,
	zhengkui_guo

On Tue, 17 May 2022 08:25:17 +0200,
Guo Zhengkui wrote:
> 
> Fix the following coccicheck warning:
> 
> sound/core/seq/seq_ports.c:142:12-14: WARNING opportunity for max()
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>

Thanks, applied now.


Takashi

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

end of thread, other threads:[~2022-05-17  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  6:25 [PATCH] ALSA: seq: replace ternary operator with max() Guo Zhengkui
2022-05-17  6:50 ` Takashi Iwai

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