From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84074C6FD20 for ; Fri, 24 Mar 2023 09:45:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231304AbjCXJpL (ORCPT ); Fri, 24 Mar 2023 05:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231452AbjCXJoq (ORCPT ); Fri, 24 Mar 2023 05:44:46 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7F326C0A for ; Fri, 24 Mar 2023 02:43:55 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B150033777; Fri, 24 Mar 2023 09:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679651019; 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=p5gU4YUVCJUKRvg7TRuNnivRS6YS1MoKDOqLZ95pv7A=; b=0g0ELczHnlGOC88a2Y0t/1ExMbIdXossK77nETDjPb/MkjhgzJQ6o4VzNwQ7dF1euKbZtK BN0gDA8dPClY/9SNSs/Qdz7y3wt9etasu1sOqKGmz/Dal5s95SuUs9r/8b39re775H8JS7 4DLjgVePw+3Xhb/lIi3EIIFnFQNlHU4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679651019; 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=p5gU4YUVCJUKRvg7TRuNnivRS6YS1MoKDOqLZ95pv7A=; b=3VaINjeq+UXxdQE+bHl75dihBMVHJs8tR1sKJ/DbvBIjoACW89B18sbUD28ROJgKdeSa8Z uwfARJkK1f/qQYAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 80049138ED; Fri, 24 Mar 2023 09:43:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XJUgHstwHWRVKAAAMHmgww (envelope-from ); Fri, 24 Mar 2023 09:43:39 +0000 Date: Fri, 24 Mar 2023 10:43:38 +0100 Message-ID: <87sfdu5vsl.wl-tiwai@suse.de> From: Takashi Iwai To: Alexander Heinrich Cc: broonie@kernel.org, perex@perex.cz, tiwai@suse.com, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH] kselftest/alsa: Fix -Wformat compiler warnings In-Reply-To: <20230324092806.363253-1-hallo@alexanderheinrich.de> References: <20230324092806.363253-1-hallo@alexanderheinrich.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Fri, 24 Mar 2023 10:28:06 +0100, Alexander Heinrich wrote: > > I noticed some -Wformat compiler warnings in pcm-test.c while building > kselftest, fix them by using the same types for format specifier and arguments. > > Signed-off-by: Alexander Heinrich Those variables (rates, channels, etc) should be rather int instead of long, as these are not 64bit parameters on 32bit archs. On top of that, the whole '%l' prefix and cast should be dropped. The only concern is the string to int conversion, and this should be checked carefully, but other than that, it must be straightforward. Care to work on that way? thanks, Takashi > --- > tools/testing/selftests/alsa/pcm-test.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c > index 58b525a4a32c..44fc5f826ab5 100644 > --- a/tools/testing/selftests/alsa/pcm-test.c > +++ b/tools/testing/selftests/alsa/pcm-test.c > @@ -371,7 +371,7 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, > goto __close; > } > if (rrate != rate) { > - snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate); > + snprintf(msg, sizeof(msg), "rate mismatch %ld != %d", rate, rrate); > goto __close; > } > rperiod_size = period_size; > @@ -437,24 +437,24 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, > frames = snd_pcm_writei(handle, samples, rate); > if (frames < 0) { > snprintf(msg, sizeof(msg), > - "Write failed: expected %d, wrote %li", rate, frames); > + "Write failed: expected %ld, wrote %li", rate, frames); > goto __close; > } > if (frames < rate) { > snprintf(msg, sizeof(msg), > - "expected %d, wrote %li", rate, frames); > + "expected %ld, wrote %li", rate, frames); > goto __close; > } > } else { > frames = snd_pcm_readi(handle, samples, rate); > if (frames < 0) { > snprintf(msg, sizeof(msg), > - "expected %d, wrote %li", rate, frames); > + "expected %ld, wrote %li", rate, frames); > goto __close; > } > if (frames < rate) { > snprintf(msg, sizeof(msg), > - "expected %d, wrote %li", rate, frames); > + "expected %ld, wrote %li", rate, frames); > goto __close; > } > } > -- > 2.34.1 >