From patchwork Sun Nov 12 07:37:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 164234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp582794vqg; Sat, 11 Nov 2023 23:37:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFNsufFEFze4KO/PAtH3PFbmYkNIB/oBECR6wkutF45h4ayKJo+p3d1Q1fdtSs5CTuAmLj X-Received: by 2002:a17:902:ecd2:b0:1cc:4e46:1de with SMTP id a18-20020a170902ecd200b001cc4e4601demr11313159plh.18.1699774664803; Sat, 11 Nov 2023 23:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699774664; cv=none; d=google.com; s=arc-20160816; b=DKGopqOmBvhe9lWb9vWbdxRKKPXG3UEFgpo2qz+omWYOdqBQhYCoGbQoHJb4bdpvwg JDaHhf19Ty91jELa0WaeMq85f2SDx1ZycbOTnE7UUwrMCAp0RsDB9TvfdGhLePisvTJa a3gbwjkJyTRn0iwUe7upoWIEGibuB/rFrW+39npEHf2LU9lDWhMp37Nk+lz0Si42xTYJ Y7helibuKbLyfpKtGNJwETvKBGQZ2+LdhY0tRPJcCfs5/AL0Ett+tkVhJDsDBn0rg7ty Rv0YnMIeIKK0WaiTWLVLrEFAGzIu06zAq88V+CrOBnxvDR27vBjCx8EJ4kG1Ser5qRFs luPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+SExa3iRH7Ca8gW1D0XoaD0vtMK+3bmRILeHnVgGh+c=; fh=Sow5ICSqF9HJ/s1e+7qnAMb7OwHC1xK3Lb+XbW+ffM0=; b=RuqG5zomgzcikly5dly4VP2iyuJuyjI3sVwMdhaM1hx9xOhZ8Oko0kV1hUsHbxZ+aG mB2Nk84tgrjFzvCMBK5H3fC91EVZuuJ91kNaS3CdqF5ttUPkXPFgKiZImlORPP8aANC+ 0ajCXanqHrQMDigxSMEFFURdQ3js0GgzpKYwHp4xWbFovTs7FFi6DrdjSwMHhKdF0Ia3 yefqvKnfw010yIkiPl5IEkxycXtXnx7Ysi0q6c2r6MuFPMfS3wm7MmHSmEME38Hv2288 Ppe3NgCkhvvT+sWmhkKSz6FQTcX3IROa7uH9WY91TZD7iBAxK2KyPKlzx2DEKSJLs1ib MIbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=cOrQyt1S; 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=wanadoo.fr Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bi6-20020a056a02024600b005824bad8f81si3266389pgb.853.2023.11.11.23.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Nov 2023 23:37:44 -0800 (PST) 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=@wanadoo.fr header.s=t20230301 header.b=cOrQyt1S; 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=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DFF098050916; Sat, 11 Nov 2023 23:37:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230251AbjKLHhO (ORCPT + 29 others); Sun, 12 Nov 2023 02:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbjKLHhN (ORCPT ); Sun, 12 Nov 2023 02:37:13 -0500 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 289F72D77 for ; Sat, 11 Nov 2023 23:37:10 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 251irZ6wGaq2K251irxRYF; Sun, 12 Nov 2023 08:37:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1699774628; bh=+SExa3iRH7Ca8gW1D0XoaD0vtMK+3bmRILeHnVgGh+c=; h=From:To:Cc:Subject:Date; b=cOrQyt1SjHP/RA29twkYAzgtIAizHd/5aONl/TDF4wKEAiQLlJW8wk4YLPbY/PD0F hHxsH2xuh4KI061eHKfdIJi5FCxG4jNSQYbXuf7azREDC+9FhdsiiSUpOwEMw3GvZS 5L9I+mhhID8YdVaS2ztTjyWJSO92FgoDkz2E1LwblGAHTpK90yJ4mioJFMN/Onc0Xw aKZ2IXs8U755U7xLpmWa4MQGaXSCXmaRCt1Vbx7ZuhFz+NoP15doZ2V4Ze93i6fkib cWp1rrzEsq+K5okptKbt63zHh3aG4EMDteovYnnGEyPt9ycwMFSJ/46lpv/rLRXMiL hWgg4Fos297QA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 12 Nov 2023 08:37:08 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Xiaowei Song , Binghui Wang , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-pci@vger.kernel.org Subject: [PATCH] PCI: kirin: Use devm_kasprintf() Date: Sun, 12 Nov 2023 08:37:01 +0100 Message-Id: <085fc5ac70fc8d73d5da197967e76d18f2ab5208.1699774592.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: 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, 11 Nov 2023 23:37:42 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782342919145212849 X-GMAIL-MSGID: 1782342919145212849 Use devm_kasprintf() instead of hand writing it. This saves the need of an intermediate buffer. There was also no reason to use the _const() version of devm_kstrdup(). The string was known be not constant. Signed-off-by: Christophe JAILLET Reviewed-by: Serge Semin Reviewed-by: Ilpo Järvinen --- drivers/pci/controller/dwc/pcie-kirin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index 2ee146767971..d9e3514de0a0 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -366,7 +366,6 @@ static int kirin_pcie_get_gpio_enable(struct kirin_pcie *pcie, struct platform_device *pdev) { struct device *dev = &pdev->dev; - char name[32]; int ret, i; /* This is an optional property */ @@ -387,9 +386,8 @@ static int kirin_pcie_get_gpio_enable(struct kirin_pcie *pcie, if (pcie->gpio_id_clkreq[i] < 0) return pcie->gpio_id_clkreq[i]; - sprintf(name, "pcie_clkreq_%d", i); - pcie->clkreq_names[i] = devm_kstrdup_const(dev, name, - GFP_KERNEL); + pcie->clkreq_names[i] = devm_kasprintf(dev, GFP_KERNEL, + "pcie_clkreq_%d", i); if (!pcie->clkreq_names[i]) return -ENOMEM; }