Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2499924rdb; Tue, 12 Sep 2023 04:04:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbFaGg22Gbx1RvDeeCYxrHSBNpYVAQF/Qy/PeFzA5YWvFZ9bUq992RfKaQbpz9fxP7FriD X-Received: by 2002:a05:6a20:6a03:b0:153:3d8f:cb24 with SMTP id p3-20020a056a206a0300b001533d8fcb24mr12927586pzk.37.1694516654915; Tue, 12 Sep 2023 04:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694516654; cv=none; d=google.com; s=arc-20160816; b=XbE9lou7lvg/mvUSZ97tXuvgwFsk7Rcj+9ynR186VXiJ/rZ5w8w0nkS5cPZYI/9DOc 4uZCRsqUbkzSy0sACS/aJbeqVPkvP2Bv3Lpeu/WafNIJDxO69l0uF8skzzG7G8hYARAN 8oB+daQE5RY8nnGIh+asCZwnDEVC5wvOSHDlma/Ni/188G708lcdXpwSPHNBdpX3Ko7s gEFdWXlSCh9XbYHXW9Bs8c/LCipjJRC0vLigo9gnf9a2dwCsq8cpRv3lQ+0KG9RuA60l IyvYDXoKfNczJSoRyIhMHy4mONyb3BA1dv5p9uRb9sZHMzP2MpHBiPrUH0bCzNyz5/6p L9nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=eQt48KJ/QqaY+R8vyld3VZahBy5CnxD3Ax9GA6Bqdv8=; fh=hPwOgEqp512qN8dGiV9QCkpV4lnvfDjwfY2COcPACPM=; b=mOod/Xx/pbC04UriQNJfyRYcOJLlAtKMq+BpORBOFpc4BDZa7mKLCuTRAbucnkYIYn MwYoeB3Ph7ReXlKo9B8XigkGsIeD6ViY5nxHg01T1l6ukrVnUdo4e0DEc0DIzAXmxZSv 3BBZsRXZz7+/XhFA32PNE+Pouzlh439b9PyI45p7ZjpIC2S+A38bU0kDnO32B5w0+4Kw EXnpnWoNvdSwFWcjcf1vulspsaPln3j+Y77r1blnEvS0ZEX8kTIzn3dzIlei3qb+hjMA VdM3QWssGA6LCDhqSyb1uyYBCNUL43i966JLbmt67UoAOdTB880hxatVs1w83RlsLXFc 4Qiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nGlHS4J8; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id v23-20020a634817000000b00565bcc15ee2si7741088pga.815.2023.09.12.04.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 04:04:14 -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=@intel.com header.s=Intel header.b=nGlHS4J8; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2087F81F964B; Tue, 12 Sep 2023 03:59:09 -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 S234351AbjILK66 (ORCPT + 99 others); Tue, 12 Sep 2023 06:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234376AbjILK6T (ORCPT ); Tue, 12 Sep 2023 06:58:19 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A7B170A for ; Tue, 12 Sep 2023 03:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694516295; x=1726052295; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=bgdwlrzvBFkSNynjDEfBcTNkpO4Ws0O02LTFY9u0GIc=; b=nGlHS4J8QG9WG64vgFtf8fhCSBl2RtmjRws+4jmXnVy1otAqcYEbveuN I+dMzgN/7HYl5P+L/J3NGxzKhJyNNA4vzp/kdA7DRBuQAcf/GrfKSz5kt gRKuwW8p13qzvLE/hnk5EBbjXm4U9LncNWZ0RhG/ZVh4ftv5UxyG9ugNO GRkDySzki9tw9LhFtiqutSbUr+Q7prU+dkdTGALVxORIxYOAAo91fRlli nklBQ6tgQAu7fWr6oZd6Fi9vPlMyQMtv8R93RStkHMRvd5cfJNfwM7psp 0M3xiZqMlI0K/Wq/HL1aKi/sr5mlvAEwJZE4dEwW+SQUDwXXW/H5nlj11 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="378251252" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="378251252" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 03:58:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10830"; a="917392364" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="917392364" Received: from mkidd-mobl.ger.corp.intel.com (HELO [10.251.217.72]) ([10.251.217.72]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 03:58:07 -0700 Message-ID: <597fcee0-a98f-4461-8f00-6033032c99e1@linux.intel.com> Date: Tue, 12 Sep 2023 13:58:10 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ALSA: core: Increase the name array size for debugfs directory name Content-Language: en-US To: Takashi Iwai , Arnd Bergmann Cc: tiwai@suse.com, Jaroslav Kysela , Masahiro Yamada , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org References: <20230912083910.15994-1-peter.ujfalusi@linux.intel.com> <96c5309d-bb06-486e-a1f8-e3d71b275f13@app.fastmail.com> <87cyyn7jvs.wl-tiwai@suse.de> From: =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= In-Reply-To: <87cyyn7jvs.wl-tiwai@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (lipwig.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:59:09 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 On 12/09/2023 13:42, Takashi Iwai wrote: > 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? Yes, this looks better, I will send a new patch in a minute. > > thanks, > > Takashi -- Péter