Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2626519rdb; Tue, 12 Sep 2023 07:34:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFwqpyEbnVphN3lrvhNJBRP71cq6w1/STRLYzXg7PosYXSmWPVaEBugNPITgwbQwfo0ywH X-Received: by 2002:a05:6a20:4401:b0:147:ecf6:c4e6 with SMTP id ce1-20020a056a20440100b00147ecf6c4e6mr14821712pzb.0.1694529286176; Tue, 12 Sep 2023 07:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694529286; cv=none; d=google.com; s=arc-20160816; b=QSoYdV8ggaAkwXGujlE3SDHlz5oklND16pBvKlvsh68DFg/gvaz23Gxqvf3aw6Z4Dy VGyC0YLlf0CZl6EcI33sQLCCC9VxaMUGgEGb1RHFVjjC46jkBObx+VcKcOmRY3B6m+wN v7vJwEUoN+pM+5VufeOGhYh+ewO21abtT+GJM3rHfXS+GM/vrOm8WZlErbjXdUGvnGVw BtEKLHWmdj7UjDzZhc2ebBiQHWGPdVHeCCBPRgj/WRRcH3CtUHUD6OleL3IpwkblMoXF kO/EIJzpw/7L0yZSrjXrMMtKouUSbVO+lT32GlejRT9ASg9g6RhLdyWuwJ4MEn6n/bKn ae7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=/5wrFpvn+Sn3FLRgspQobsMn/iApsHJiZE1ii4FaPxk=; fh=tL9nnmnI8VXA833DgpDRxi41PvrjXmSJWNgARuuKLdI=; b=Uzc7YWE+CpTWBfkvcgTixirQILnhlKH9A7VIUYiFgkHyQ6fJSOBQeE9e90+VW178Cc YSB0kCYM89+N11S8evoBOI/0t98L1Yt5BUQyMVThkOuBruKKF3SvZLPdLQdOOGQFdcv4 BHmOR8AGuBj2YKegaaAt1xd6wOtTEq2XyOPVdyzPcFQa66Xen93Bit3c/hTilfCzkHgQ fpNNiN0cU8vd+HXbtULHq8J0bWrjtOmeuetU897p/OeT+OxSP6evEMLHsFGZqStvltvx ry7NAdHidf2AX7429JDp93B9t0bJBBHX+dmnfUFavJ/aLUcbb60zhoOKVrrYmrkDzSmU pGeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MvQSgm0k; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=M4LqoX+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cg11-20020a056a00290b00b0068ff741579fsi286476pfb.318.2023.09.12.07.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 07:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MvQSgm0k; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=M4LqoX+d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 70226802578F; Tue, 12 Sep 2023 03:42:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234252AbjILKmj (ORCPT + 99 others); Tue, 12 Sep 2023 06:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbjILKmi (ORCPT ); Tue, 12 Sep 2023 06:42:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5291D9F for ; Tue, 12 Sep 2023 03:42:34 -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 78AEB212AE; Tue, 12 Sep 2023 10:42:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1694515352; 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=/5wrFpvn+Sn3FLRgspQobsMn/iApsHJiZE1ii4FaPxk=; b=MvQSgm0kaxtWFRRmzM5zkkxDCXVpgCRBRlRhZ3+1NYv1TUuyF4y/1P47gIBi9uBh+Mmmpt VQOQ1eYLe7/NKHVYS2u5Uh06YjCGPcMLNYEduG5NNqVGCyT2YHxoVxrvW+WhAKRJDKe2KO xXubEm5yutZGpCWIN7EOnpXoUv/xRjw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1694515352; 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=/5wrFpvn+Sn3FLRgspQobsMn/iApsHJiZE1ii4FaPxk=; b=M4LqoX+dAZv9RRJ/UE16syo5NqxE6RilgKmrJNFek5MrztBtyd/Vpmp1tgKV1YO8ChdbWe CGEo9HFWKzcOwMBg== 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 3940613A39; Tue, 12 Sep 2023 10:42:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l68DDZhAAGXeXAAAMHmgww (envelope-from ); Tue, 12 Sep 2023 10:42:32 +0000 Date: Tue, 12 Sep 2023 12:42:31 +0200 Message-ID: <87cyyn7jvs.wl-tiwai@suse.de> From: Takashi Iwai To: "Arnd Bergmann" Cc: "Peter Ujfalusi" , tiwai@suse.com, "Jaroslav Kysela" , "Masahiro Yamada" , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Subject: Re: [PATCH] ALSA: core: Increase the name array size for debugfs directory name In-Reply-To: <96c5309d-bb06-486e-a1f8-e3d71b275f13@app.fastmail.com> References: <20230912083910.15994-1-peter.ujfalusi@linux.intel.com> <96c5309d-bb06-486e-a1f8-e3d71b275f13@app.fastmail.com> 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:42:39 -0700 (PDT) On Tue, 12 Sep 2023 12:18:04 +0200, Arnd Bergmann wrote: > > On Tue, Sep 12, 2023, at 10:39, Peter Ujfalusi wrote: > > > While the code is correct, we need to silence the compiler somehow. > > It could be done by limiting the range in sprintf like > > sprintf(name, "card%d", idx % SNDRV_CARDS); > > sprintf(name, "card%hhd", idx); > > etc > > > > These are too workaroundish. Increase the name array to 15 instead which > > looks better and only adds 7 bytes on stack. > > It looks like we use the same string for kobject_set_name(), so > maybe this would work as well: > > --- a/sound/core/init.c > +++ b/sound/core/init.c > @@ -278,9 +278,6 @@ static int snd_card_init(struct snd_card *card, struct device *parent, > size_t extra_size) > { > int err; > -#ifdef CONFIG_SND_DEBUG > - char name[8]; > -#endif > > if (extra_size > 0) > card->private_data = (char *)card + sizeof(struct snd_card); > @@ -364,8 +361,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent, > } > > #ifdef CONFIG_SND_DEBUG > - sprintf(name, "card%d", idx); > - card->debugfs_root = debugfs_create_dir(name, sound_debugfs_root); > + card->debugfs_root = debugfs_create_dir(kobject_name(&card->card_dev.kobj), > + sound_debugfs_root); The idea looks neat, but I suppose it's better with dev_name(&card->card_dev) instead? thanks, Takashi