From patchwork Sun Nov 12 07:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 164235 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp584617vqg; Sat, 11 Nov 2023 23:44:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeFXM1dhxrGNsG1xtD8lHXjsJG0ua83IlgkipFhymtKXoIpSqSrtr8V+ABGn5SKJaC94nm X-Received: by 2002:a05:6358:6f09:b0:16b:adb5:72d5 with SMTP id r9-20020a0563586f0900b0016badb572d5mr5754476rwn.14.1699775079494; Sat, 11 Nov 2023 23:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699775079; cv=none; d=google.com; s=arc-20160816; b=dbhD7DENX7V8PPfyh2jjKbo2Np+Qxr672+0FNXrNzvchtJUlmv+taQe8JIBbLdQx2u w6oOWCW2yZuzxl/v1ypZ2sGB3Gh1XUtbnI2jJoSigGA7L0JcQRSsQxlvi3Ztjox4RcR5 XJmkPIWGYGjXS5gSE5/O5yEE8gCBD1FXLVpw2rCv78rbA/Ru+YnsQQLC2rWa6/R4/utM DGmzdInmDsRiI9LVOi1x3qHuwbUOFu6cS+xSwQIq2ee8t6cqBdC3J5DFTydeD5vqWGV6 tVVE//FvB0DBMhZr1EO2tovMG5pv1bKfGMI6i05i9AuAVvSlx4mW9C8wpJ77/mtGu5N2 lLZQ== 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=CMJ7mtbkQ6wr2X7EyGA8oyEfbM3Nf5YejXN8k/sc2Rw=; fh=PDZW1rgcyE3twCNDgnqBJGihw76hLatGpKE+bXUuOSg=; b=ykBtAeoXS/IeQSrL7UqyZtrAjjgadwH0I+/g91jcEm+6ygIVB3eHUrsW29LxpZetRP Jl69Gz/GuyYdJYFcTpka4HrwJGcDkr8LRvOtKAFZC065hYltvEHErNQMNLOvKZnY2hpp ByFyx/Cvx8lnAumT10+oP9NDsCDNfHl9i2VG35n49IsPHvJQ3PR2gIJYrbvUuqsLH3gs f4IeHwo811/H8xxF2MU1u19SVKMuTVS5NmhwUjc/N+0i5w0KzndhIn14AwZk1xETTgiy TAxm8YLiqczq86lQwuVHevp6WihgfPEseTjr2PQ6xizzmRoZXsVk6iK/twgeYE4guoq/ uynw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ersE2zY+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id i186-20020a639dc3000000b005ab1fd6fbc1si3189506pgd.847.2023.11.11.23.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Nov 2023 23:44:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ersE2zY+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 763D5809C1B7; Sat, 11 Nov 2023 23:44:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230251AbjKLHoZ (ORCPT + 29 others); Sun, 12 Nov 2023 02:44:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbjKLHoY (ORCPT ); Sun, 12 Nov 2023 02:44:24 -0500 Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011332D77 for ; Sat, 11 Nov 2023 23:44:21 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 258kraxZkSnL0258kru9kF; Sun, 12 Nov 2023 08:44:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1699775060; bh=CMJ7mtbkQ6wr2X7EyGA8oyEfbM3Nf5YejXN8k/sc2Rw=; h=From:To:Cc:Subject:Date; b=ersE2zY+Kx3K9M/oDZf/q2qmZMRggYKp7QWd9xNoylpaz16so9XmICfsr/zPUKeKY S0qRxmbdBHCHwWbc/mxfzJ6H+0XJtRb6jeRafZ6A5Ge7FQfHJZFJdbIs62JNplMPRG ur+wLFZyn4k7hhL+2mS3wzTLnXfl2E0Qg4nfvGaNVE7OmT1dIjcmRuOIlGJFJKvXZL 1ZB44QWXHDqZSQcVWnaNTuhCEEvOj452lDib40/Sp4w1QoznsFBfe726kUG44yy2nW jxVmCAXxlRmD6ATPfV9CghnQ6G8GhFAn2zBgn3POK1SY2Tsu0Sy2AaTmTzl0z6+5RP R9+27WG5NGlWg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 12 Nov 2023 08:44:20 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Gross Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org Subject: [PATCH] platform/x86/dell: alienware-wmi: Use kasprintf() Date: Sun, 12 Nov 2023 08:44:15 +0100 Message-Id: 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 fry.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 (fry.vger.email [0.0.0.0]); Sat, 11 Nov 2023 23:44:37 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782343354184060952 X-GMAIL-MSGID: 1782343354184060952 Use kasprintf() instead of hand writing it. This saves the need of an intermediate buffer. Signed-off-by: Christophe JAILLET Reviewed-by: Ilpo Järvinen --- drivers/platform/x86/dell/alienware-wmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index a9477e5432e4..f5ee62ce1753 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -429,7 +429,6 @@ static DEVICE_ATTR(lighting_control_state, 0644, show_control_state, static int alienware_zone_init(struct platform_device *dev) { u8 zone; - char buffer[10]; char *name; if (interface == WMAX) { @@ -466,8 +465,7 @@ static int alienware_zone_init(struct platform_device *dev) return -ENOMEM; for (zone = 0; zone < quirks->num_zones; zone++) { - sprintf(buffer, "zone%02hhX", zone); - name = kstrdup(buffer, GFP_KERNEL); + name = kasprintf(GFP_KERNEL, "zone%02hhX", zone); if (name == NULL) return 1; sysfs_attr_init(&zone_dev_attrs[zone].attr);