All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [bug report] ALSA: seq: Fix assignment in if condition
Date: Thu, 17 Jun 2021 15:41:00 +0200	[thread overview]
Message-ID: <s5hv96cy5g3.wl-tiwai@suse.de> (raw)
In-Reply-To: <YMtLi0qCOc00eEcF@mwanda>

On Thu, 17 Jun 2021 15:18:03 +0200,
Dan Carpenter wrote:
> 
> Hello Takashi Iwai,
> 
> The patch f9a6bb841f73: "ALSA: seq: Fix assignment in if condition"
> from Jun 8, 2021, leads to the following static checker warning:
> 
> 	sound/core/seq/oss/seq_oss_init.c:99 snd_seq_oss_create_client()
> 	warn: 'port->addr.port' is unsigned
> 
> sound/core/seq/oss/seq_oss_init.c
>     82  
>     83          /* create annoucement receiver port */
>     84          memset(port, 0, sizeof(*port));
>     85          strcpy(port->name, "Receiver");
>     86          port->addr.client = system_client;
>     87          port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */
>     88          port->type = 0;
>     89  
>     90          memset(&port_callback, 0, sizeof(port_callback));
>     91          /* don't set port_callback.owner here. otherwise the module counter
>     92           * is incremented and we can no longer release the module..
>     93           */
>     94          port_callback.event_input = receive_announce;
>     95          port->kernel = &port_callback;
>     96          
>     97          call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port);
>     98          system_port = port->addr.port;
>     99          if (system_port >= 0) {
>                     ^^^^^^^^^^^^^^^^
> This was from the old code.  It's not clear what is going on.  I think
> the condition can be deleted.

Yeah, that's a quite old code.  The check should have been like

	if (call_ctl(SNDRV_SEQ_IOCTL_CREATE_PORT, port) >= 0) {
		....

and system_port is assigned in that block.
I'll cook up the patch.


thanks,

Takashi

      reply	other threads:[~2021-06-17 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 13:18 [bug report] ALSA: seq: Fix assignment in if condition Dan Carpenter
2021-06-17 13:41 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hv96cy5g3.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.