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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 6FF28C2B9F7 for ; Wed, 26 May 2021 07:41:41 +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 0D78361413 for ; Wed, 26 May 2021 07:41:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D78361413 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 B15C91744; Wed, 26 May 2021 09:40:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B15C91744 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1622014897; bh=95XV/mJeUTgz1o5r/9Gr5Ag/oQpNonoyscxX6HGyuL8=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MKO50uDHafWdAdsZG/WIyJgxV35qNQPxUZenSctoJwFPbP5UU1NNeqRxMZJbDO71S F/1z3jt8/7aFdhTKxthjKV0LZhXOAcxHzAikKK70ScH+Y/fUfWydmeiQGFNgQsK3Jj CTesnmrgDMbiRS36GGjG46wtXeMoRKNe2wbfxB3E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 46AFAF8014C; Wed, 26 May 2021 09:40:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9B29F80157; Wed, 26 May 2021 09:40:45 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (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 CBE30F8010D for ; Wed, 26 May 2021 09:40:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CBE30F8010D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="0hD7FouA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="4oRkO0z5" X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622014841; 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=vTPFRqhh6JSx/ggr3vZMjfP9IEHvHmbXCJMu9eRcsCs=; b=0hD7FouA/PITPowff1yOAWp1AJFk+paMrgDb+L9SC7zHhyhk7J7XtOOoK78qwhm6dWAkrG ghcbqRIaR6YGDK0VPHF7aFe3HoL+Qbcr9+upRHg8uj3a5QsnlKsWqLZJAwNnGCkcfG1U2i xtGeNMqmESw55QMcbBEy1jcpQ87jLNs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622014841; 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=vTPFRqhh6JSx/ggr3vZMjfP9IEHvHmbXCJMu9eRcsCs=; b=4oRkO0z5CfuMkv6/CuQKvd98qMd+rOmJwMc6a4Fp95aSoUhtpMoDKuMUou2dk9VY/B0Cta XxF5xObvhg7Y7GDg== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 808E7AE38; Wed, 26 May 2021 07:40:41 +0000 (UTC) Date: Wed, 26 May 2021 09:40:41 +0200 Message-ID: From: Takashi Iwai To: Pierre-Louis Bossart Subject: Re: Sparse errors In-Reply-To: <6b86f44e-82e0-3530-b579-1b054f459880@linux.intel.com> References: <6b86f44e-82e0-3530-b579-1b054f459880@linux.intel.com> 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: Colin Ian King , alsa-devel@alsa-project.org, Dan Carpenter 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 Tue, 25 May 2021 21:32:27 +0200, Pierre-Louis Bossart wrote: > > Hi Takashi, > Sparse reports a lot of new issues in our last checks with more options: > > export ARCH=x86_64 CF="-Wsparse-error -Wsparse-all > -Wno-bitwise-pointer -Wno-pointer-arith -Wno-typesign -Wnoshadow > -Wno-sizeof-bool" > make -k sound/ C=2 > > most are linked to the __user and pcm_format_t restricted types, but I > found the simpler ones below which are useless comparisons. I can send > a patch for the last but not sure how to address the first two. > > Thanks for your feedback > -Pierre > > sound/core/info.c:95:38: error: self-comparison always evaluates to false > > if (pos < 0 || (long) pos != pos || (ssize_t) count < 0) > return false; > > not sure what the second comparison is meant to check? As Dan suggested, it's a check only for 32bit architecture for a 64bit value. > sound/drivers/opl3/opl3_midi.c:183:60: error: self-comparison always > evaluates to false > > This indeed makes no sense. the voice_time and vp->time are not > changed in the loop, the test is either redundant or something else is > missing. The code doesn't look right, indeed. It's likely meant to be vp2 instead of vp. --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -180,8 +180,7 @@ static int opl3_get_voice(struct snd_opl3 *opl3, int instr_4op, if (vp2->state == SNDRV_OPL3_ST_ON_2OP) { /* kill two voices, EXPENSIVE */ bp++; - voice_time = (voice_time > vp->time) ? - voice_time : vp->time; + voice_time = max(voice_time, vp2->time); } } else { /* allocate 2op voice */ > sound/pci/lx6464es/lx_core.c:677:34: error: self-comparison always > evaluates to false > > That seems like dead code indeed: > > u32 channels = runtime->channels; > > if (runtime->channels != channels) > dev_err(chip->card->dev, "channel count mismatch: %d vs %d", > runtime->channels, channels); Yes, this can be deleted. thanks, Takashi