Message ID | 20230916-topic-pcmtest_warnings-v1-1-2422091212f5@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1796671vqi; Sat, 16 Sep 2023 11:26:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPc6ue1wLuMGwF5VYyUVsuMzpLw0AvYe3LuvMQfJaWcfA44wxgmsh997JRd64ogsokuKEI X-Received: by 2002:a05:6a20:1583:b0:140:a6ec:b55f with SMTP id h3-20020a056a20158300b00140a6ecb55fmr6548881pzj.16.1694888808688; Sat, 16 Sep 2023 11:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694888808; cv=none; d=google.com; s=arc-20160816; b=ejN/OV3i8x6IHW6uY3Hf4k2ezIoF9+mW/blz3wIW72qVZb5sxYDLnIavRXLxpP0Tr/ Dv347YH0DlwN7WudfNbAOUwf/KFlBJffXkc8WUGaaLX1Y7aKdqcxn6b0xgg6PyPS6p8s PJ4q9e8UpQQEbgAGq8cAKgvzSHrKWPeFqvzFg8qDJihzjvW2uqit/3dVnixNLsNVhNm2 JVMLWATVcEZrQFegc44o71RFez98hPUIB/kWvwttHa/jEWVinJnVYfQxCiQe1R3LJum/ vCHi1BQcYorDxwRbeMORTlQZ1ILjE+0m6yd+ipDn00SgBwLuy+xWIxVcZG1WiggkePlV JYFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=WVGzsDlKuJKroPOhSkmnAeMyQ1dYs3e+BSZkz5C7wOU=; fh=XbzMicyeh/Tq2FTFbDaVyhL3d8bcg2iij/LFG4Yvofk=; b=UVSzXzHrcqZBXT0JKTj38KRcG6wVDwrjVSBAwAkD3On6g720O6iTb2KoMgX9DxBDO6 0sawx8JZv4qje82WQGzvdJnJu4N7goO5hzAzTF3//bi+ZYOnsvIw1HgfDdAa05DM5TcV zIO3VLPpyx03dN6y3DVMZt2RMuXuBTCN1nxdVpnST2ttAfktlcdFslFMd2ty+gH/IKNZ 4ETswG+Nb6FecHD2dKx86C0BdIV/4SRB8E1KSRSVr3vPW2smNC4Y90+ndY7g1cYtGiq8 GLhLPFtmYZJiJya53tOxjb8ryIC2Gr5iqfbTk3o9IWk2eA++DLsq3jiAw2XKUGrM/rio 2c1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BO1HRME2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b20-20020a6567d4000000b00573fcfd4a19si5213592pgs.878.2023.09.16.11.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 11:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BO1HRME2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 949138348259; Sat, 16 Sep 2023 08:23:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236002AbjIPPW1 (ORCPT <rfc822;toshivichauhan@gmail.com> + 29 others); Sat, 16 Sep 2023 11:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233029AbjIPPWN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 16 Sep 2023 11:22:13 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26752CE7; Sat, 16 Sep 2023 08:22:08 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-99c136ee106so403741366b.1; Sat, 16 Sep 2023 08:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694877726; x=1695482526; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=WVGzsDlKuJKroPOhSkmnAeMyQ1dYs3e+BSZkz5C7wOU=; b=BO1HRME2KvN9zXrpEpC5QWa6BSI85H9/JuUS7nfBSWB3OvxCYfRrclkChLEoMn85Tn 5jo2enHSEbs9VN0BnWaCZ5KZN7tHuu/2VBIU/B9L5ItTK/8f6WLObfko/aqcvhGicvXs wHl0xzVXev0keMJRTSE5snJOi+8CzMSeYfwGKOYnXGDZkpFdTA839FHJL192nRdwkm/+ 4on4DE9HfKA+6IdB/LjoSoytdhim/mSIvO1oysITgb06waNR/NkMI8+4DCMK+gUccN36 ddxxKUFiRW6ZJFTRFavlVF92GXgTSvlt0/KGLrWRgacjYxWGv8UMRU39I4yXBPP8OKEr r0TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694877726; x=1695482526; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WVGzsDlKuJKroPOhSkmnAeMyQ1dYs3e+BSZkz5C7wOU=; b=sjo2YONCitfUyMWDyNIVgutPuVBZjdQRQ3bIiJD5/rtKmL1T8smfSoZMC7f+NyxufR kv9r1ilCnTCICfIIQ6pb1qamTrDN1fGtm8u2VJIoMrZbtC+mHB1fy5kqSH5yqhCfLCyq FvlUDUWtQaMGfbO8F3p5L2XYc3SSc0TnGu3YSNB2ftTKzVnGqX5mvkOpqrM/Wz5JZbL3 wOmnfvYyrSmN7af8VVrJQkOEhGOPbg7H/JjjenaE0caFX0ojIGLJBeLHbkA0ce9lFfTn Q1mjZP3sZd8qFIYh/t3J3rhHUux/qlPUuGQzV0Xp3QKzjVu5ZPXqNBUDbEf97uXC+m8H xeuQ== X-Gm-Message-State: AOJu0YwtwU1B/T50vIM50amOzccQ4AuZnm8lJZHN4jdXtSVsr9dCevMp 8j2YGmPiPf+4NZXWUeZryeZM8qjhDagE6A== X-Received: by 2002:a17:906:5183:b0:9a1:fb4c:3b6c with SMTP id y3-20020a170906518300b009a1fb4c3b6cmr3989754ejk.59.1694877726288; Sat, 16 Sep 2023 08:22:06 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41b4-ce80-0e99-b4c7-72af-eba7.cable.dynamic.v6.surfer.at. [2a02:8389:41b4:ce80:e99:b4c7:72af:eba7]) by smtp.gmail.com with ESMTPSA id p5-20020a1709061b4500b0099bcf9c2ec6sm3822103ejg.75.2023.09.16.08.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 08:22:04 -0700 (PDT) From: Javier Carrasco <javier.carrasco.cruz@gmail.com> Date: Sat, 16 Sep 2023 17:22:02 +0200 Subject: [PATCH] selftests: ALSA: fix warnings in 'test-pcmtest-driver' MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230916-topic-pcmtest_warnings-v1-1-2422091212f5@gmail.com> X-B4-Tracking: v=1; b=H4sIABnIBWUC/x2NXQqDMBAGryL73EA0pX9XKaXE5Ksu2DVk0yqId 2/o4wwMs5EiM5RuzUYZX1aepUJ7aCiMXgYYjpWps52z1/Zkypw4mBTeBVqei8/CMqhBtOcjIuD chWrce4Xps5cw1lw+01Rlynjx+r/dH/v+A291bfJ9AAAA To: Ivan Orlov <ivan.orlov0322@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Shuah Khan <shuah@kernel.org> Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco <javier.carrasco.cruz@gmail.com> X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694877723; l=1641; i=javier.carrasco.cruz@gmail.com; s=20230509; h=from:subject:message-id; bh=/ZkE2aVCHFyUYumMe8VecCnjdA9CPGn0CksaV8Mvf/s=; b=8rbNDw8hACyDjOlhCkl50WXigQ4v6zK0hH4HJvTe2D8UM3KCBmiJyRrH8nDQxrnwPxEjg8Pju 6zVzSh+w6YfAHc/Z9L0ZOVHUfipd17mJDMcpSj0RgUeo9+F/GEWVrH6 X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 16 Sep 2023 08:23:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777219727330225025 X-GMAIL-MSGID: 1777219727330225025 |
Series |
selftests: ALSA: fix warnings in 'test-pcmtest-driver'
|
|
Commit Message
Javier Carrasco
Sept. 16, 2023, 3:22 p.m. UTC
Defining the 'len' variable inside the 'patten_buf' as unsigned
makes it more consistent with its actual meaning and the rest of the
size variables in the test. Moreover, this removes an implicit
conversion in the fscanf function call.
Additionally, remove the unused variable 'it' from the reset_ioctl test.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Defining the 'len' variable inside the 'patten_buf' as unsigned
makes it more consistent with its actual meaning and the rest of the
size variables in the test. Moreover, this removes an implicit
conversion in the fscanf function call.
Additionally, remove the unused variable 'it' from the reset_ioctl test.
---
tools/testing/selftests/alsa/test-pcmtest-driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
change-id: 20230916-topic-pcmtest_warnings-ed074edee338
Best regards,
Comments
On 9/16/23 19:22, Javier Carrasco wrote: > Defining the 'len' variable inside the 'patten_buf' as unsigned > makes it more consistent with its actual meaning and the rest of the > size variables in the test. Moreover, this removes an implicit > conversion in the fscanf function call. > Considering the fact that the pattern buffer length can't be negative or larger that 4096, I really don't think that it is a necessary change. > Additionally, remove the unused variable 'it' from the reset_ioctl test. > Your patches should always contain only one logical change. If you, for instance, remove redundant blank lines, combining it with something else is fine, but otherwise you should split the changes up. > Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> > --- > Defining the 'len' variable inside the 'patten_buf' as unsigned > makes it more consistent with its actual meaning and the rest of the > size variables in the test. Moreover, this removes an implicit > conversion in the fscanf function call. > > Additionally, remove the unused variable 'it' from the reset_ioctl test. You don't need this text here. Usually it is the place for changelog between patch versions if we have more than one version of the patch. For instance, if you send a patch V2, it could look like this: Signed-off-by: ... --- V1 -> V2: - Improve something - Add something So, don't repeat the commit message here :) Anyway, great job! I believe this test could be enhanced in lots of ways, so I look forward to seeing new patches related to it from you :) -- Kind regards, Ivan Orlov
Hi Ivan, On 16.09.23 20:05, Ivan Orlov wrote: > On 9/16/23 19:22, Javier Carrasco wrote: >> Defining the 'len' variable inside the 'patten_buf' as unsigned >> makes it more consistent with its actual meaning and the rest of the >> size variables in the test. Moreover, this removes an implicit >> conversion in the fscanf function call. >> > > Considering the fact that the pattern buffer length can't be negative or > larger that 4096, I really don't think that it is a necessary change. > >> Additionally, remove the unused variable 'it' from the reset_ioctl test. >> > > Your patches should always contain only one logical change. If you, for > instance, remove redundant blank lines, combining it with something else > is fine, but otherwise you should split the changes up. > Removing an unused variable is actually removing a blank line from a logical point of view. Is an extra patch not overkill considering that it cannot affect the code behavior? >> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> >> --- >> Defining the 'len' variable inside the 'patten_buf' as unsigned >> makes it more consistent with its actual meaning and the rest of the >> size variables in the test. Moreover, this removes an implicit >> conversion in the fscanf function call. >> >> Additionally, remove the unused variable 'it' from the reset_ioctl test. > > You don't need this text here. Usually it is the place for changelog > between patch versions if we have more than one version of the patch. > For instance, if you send a patch V2, it could look like this: > Sorry, this got merged from the cover letter by b4. I will be more careful next time, thanks! > Signed-off-by: ... > --- > V1 -> V2: > - Improve something > - Add something > > So, don't repeat the commit message here :) > > Anyway, great job! I believe this test could be enhanced in lots of > ways, so I look forward to seeing new patches related to it from you :) > > -- > Kind regards, > Ivan Orlov Thanks for your feedback and best regards, Javier Carrasco
On 9/16/23 22:25, Javier Carrasco wrote: > Removing an unused variable is actually removing a blank line from a > logical point of view. Is an extra patch not overkill considering that > it cannot affect the code behavior? Well, no, it is not, as the line is not blank (nothing except removing a blank line could be considered as blank line removal) :) And an extra patch is not an overkill in case if you are separating logical changes. However, rules may vary from one subsystem to another, so it is up to Shuah to decide take this patch or not. My opinion is that such changes should be separated into different patches.
diff --git a/tools/testing/selftests/alsa/test-pcmtest-driver.c b/tools/testing/selftests/alsa/test-pcmtest-driver.c index 357adc722cba..f0dae651e495 100644 --- a/tools/testing/selftests/alsa/test-pcmtest-driver.c +++ b/tools/testing/selftests/alsa/test-pcmtest-driver.c @@ -13,7 +13,7 @@ struct pattern_buf { char buf[1024]; - int len; + unsigned int len; }; struct pattern_buf patterns[CH_NUM]; @@ -313,7 +313,6 @@ TEST_F(pcmtest, ni_playback) { */ TEST_F(pcmtest, reset_ioctl) { snd_pcm_t *handle; - unsigned char *it; int test_res; struct pcmtest_test_params *params = &self->params;