Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CC35C2B9F4 for ; Thu, 17 Jun 2021 13:42:02 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7E3361055 for ; Thu, 17 Jun 2021 13:42:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7E3361055 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A7ECE16F3; Thu, 17 Jun 2021 15:41:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A7ECE16F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623937318; bh=1x7lBiTROX3Paa7t0+fRpBg0OD8OWjqcBWlUCBqeEL8=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=t+vTGMnPHD7ME8BQt7ic0GmTTJLgd5Jd4HQAdkZdRMblTqj6aZ8FrgmP0YxBVsJfs OfTQ4K8X0eipRxbEV1Vekfu4BtpvxOodJmLKYxhEkaucHu1j/NsSs9tNaZmS//7W2i stZih7M0INBftqodtZOUCCuWnYs7+0+F6G7Pdxro= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 520BAF80171; Thu, 17 Jun 2021 15:41:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8B9EAF8025A; Thu, 17 Jun 2021 15:41:07 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7442AF80088 for ; Thu, 17 Jun 2021 15:41:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7442AF80088 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ENqes35Q"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="KW2VuicL" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AEE671FD7B; Thu, 17 Jun 2021 13:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623937260; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZP3JykNcsz4aMH26tpHmmUDp4+25Ry560NXEWIdkttg=; b=ENqes35QGeG3R3J2g83DTpm79/+9xhw0MoMYzpaBdtD6/ri+eziqYtiKScZR3PFffWqdrt MBV5/QgW6Ht4vp1gqquitVp0+AtliZ3ZZNQX2LUcle5okDiIZsuGIwiJNVFlj/cYhpdF5S Wz2lBR0rQ7WDowy+5ZjaIhfOkwwCVzo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623937260; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZP3JykNcsz4aMH26tpHmmUDp4+25Ry560NXEWIdkttg=; b=KW2VuicLEwxAfbqoPEUxlH6wEkKMvdqPr33YpD+5JsHIS9snNZ6kF8WbDNUXQtofI4fepP fsx5VQsQAOc8J9CA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id A98BAA3BA9; Thu, 17 Jun 2021 13:41:00 +0000 (UTC) Date: Thu, 17 Jun 2021 15:41:00 +0200 Message-ID: From: Takashi Iwai To: Dan Carpenter Subject: Re: [bug report] ALSA: seq: Fix assignment in if condition In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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