Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1409473lqa; Mon, 29 Apr 2024 07:47:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVR9U3Gb6XbqECCpiwsJ2bA0DOTV0dOKGCpVtkRwXBesLo6j35paq/B9yNm82qG1K1ca80u4xBxy8tY1oVzKVJkpUOGuh5RNE7EzIrQdA== X-Google-Smtp-Source: AGHT+IGFXQMjNv/pQVhlQ4uxg+lF5A1dD48zy/4DpTw4hENhjwRkQgIXNHHtjZghdEVrauPpcJ4m X-Received: by 2002:a05:620a:1378:b0:790:829c:91a7 with SMTP id d24-20020a05620a137800b00790829c91a7mr11218887qkl.24.1714402033601; Mon, 29 Apr 2024 07:47:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714402033; cv=pass; d=google.com; s=arc-20160816; b=jen/tgsBw19BAThaBd/dy+OBQvAMbxtSk88sUacI/35C4F/ofT4fVzMjB2C9pvwmVD PkFS79Hj04ciNapPITTs0l3OA4T/zn2SFs6PSR3hhdL58gslhhCOsX/ggCtkDsjM/gSN MGykgO0hGcSDYPBr1V7P/R7SKKa69N/844bK8ZLPrTrUTx79y3J/aHWZpaO1igWKLAQa haE2YTzHDikUyMqt7iH5nTD2AVJ2luhSGd2HqDEwfpsh/QhZATFv6+2jE2p6/u/xeKMQ xT3ZpRYfvCYcRZ8CclwAESwBGKTKuG3LKGTgGLBT7MrrgXB9JBiyuC77q30l/lCgC0gx f5Ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:dkim-signature; bh=ykI1Zq3XyBGqKWUKJ4NpyzoBp/V6ONFzGC32QBzeric=; fh=9+JPiKUqmiwg7nrgynbn+qu8x0UhUJwyp0gAHVwwYQs=; b=t/rU0BNDw7+n9EkFymfJ6ImQaJq0UK46Qjh9wQjUHxyIklit4fhhR6/dUsvL5luV2n nuAoBOPyMgufjjrPyWd2u6R1YZu2zoD+dRDi/aeBhU2kvGL4qa/1i1rDceb/Hs1sG5+u WW9DBYgMwqhCPeb+/IZUIzXq1M1pPu4JK94HGtVUkh+IENxoF0awrcVXsZPD5Lwn3ann ML6/yGcBEcneM3NsCdmCX9BdHpbPU09rWlZcKWbxoisHALnIdUo/99XJSQ6nDhDoolE/ X6ne2JA5aF6MXfkxqZNyqMt87fFCSV/AqMWwoBAd/EPryhyAaQabqVmc6LCiRRNnhy1f n+UQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=ff8RvQJf; arc=pass (i=1 spf=pass spfdomain=rere.qmqm.pl dkim=pass dkdomain=rere.qmqm.pl dmarc=pass fromdomain=rere.qmqm.pl); spf=pass (google.com: domain of linux-kernel+bounces-162476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id az32-20020a05620a172000b00790f88484b4si2019439qkb.264.2024.04.29.07.47.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 07:47:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=ff8RvQJf; arc=pass (i=1 spf=pass spfdomain=rere.qmqm.pl dkim=pass dkdomain=rere.qmqm.pl dmarc=pass fromdomain=rere.qmqm.pl); spf=pass (google.com: domain of linux-kernel+bounces-162476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BE7641C21764 for ; Mon, 29 Apr 2024 14:46:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 742D883CBA; Mon, 29 Apr 2024 14:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="ff8RvQJf" Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA91180624 for ; Mon, 29 Apr 2024 14:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.227.64.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714401941; cv=none; b=jRCVTWr2rWMeGta7guolOr5kmlfEN91wvPxQbapSFIiQxpnHXVEs6yLpxBrqv8kiAUP4iaUVBhdiGbg5bXNPyPl+81gxcl7bcu5ZxbhYan8LnKTVKJ/eIvTM7qLOKJqcws3uhRCPP02Gr8QSKuzUgcInKQqyNaivGRN4Ze5Z/z8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714401941; c=relaxed/simple; bh=SQFjFnDvj4pBVC5wVcGxU/7jwPxTwAo0q5RMDCeQAH4=; h=Date:Message-Id:In-Reply-To:References:Subject:MIME-Version: Content-Type:From:To:Cc; b=kfjsIT/5rW1V9Y8Nt2YtjVaJV9H+Nxew8V4Q32ZrtUpEr9Ai+gsN5yDbOOvuIVEMQvuk3fmyeWBrR+HZOQaUQXcKlb7Gf3ugQyVZnBRxyyzt7HhnzqU+U6VsAChf06DZ/kSP4PSQ1iVTdMEF2GtKM4SVx7gVrjVCZxFT1ODGFRc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rere.qmqm.pl; spf=pass smtp.mailfrom=rere.qmqm.pl; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b=ff8RvQJf; arc=none smtp.client-ip=91.227.64.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rere.qmqm.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rere.qmqm.pl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1714401931; bh=SQFjFnDvj4pBVC5wVcGxU/7jwPxTwAo0q5RMDCeQAH4=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=ff8RvQJfgPFfPn3n24LNh7YmnyyvRDaQfxk3WY6L3jXeNXHFfERWjsGno2mQ/BuJr YFuVwwptDS9hNmqExoO14nmqD6mpb4RTF6dsnSB3n6Ue1m2wWzquBec2KpCtScaDW1 Ts1XsxxhPbQNIa49oY6O8jMeZPEg81FsRfn5RUNpktsQ9Jse55xP4PlTkkW4TK/x5Z 0piKBUn5ngKrY65OK67wmi9LmpXNfX4VbuQerQ5RDSLW5qMFGCe/lX5g9C7qJwolJU KFYdGSkLlDwQUhA+YqdtGJk18CDz1olvhq++djjwxJGXgtlo21EnYYu6ngUh0c79MO rNp3uu+duAgdQ== Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4VSmMv0rxTzbm; Mon, 29 Apr 2024 16:45:31 +0200 (CEST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 1.0.5 at mail Date: Mon, 29 Apr 2024 16:45:30 +0200 Message-Id: <92a354a86ceb572c4fde35047177c5681d83f81f.1714399603.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: Subject: [PATCH v2 08/12] regulator/core: set_consumer_device_supply: avoid copying const data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org As consumer_dev_name might as well be const, don't copy it if not required. Signed-off-by: Michał Mirosław --- drivers/regulator/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index efb68a5c85af..431e1c164b11 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1747,7 +1747,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, new_node->supply = supply; if (consumer_dev_name != NULL) { - new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); + new_node->dev_name = kstrdup_const(consumer_dev_name, GFP_KERNEL); if (new_node->dev_name == NULL) { kfree(new_node); return -ENOMEM; @@ -1782,7 +1782,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, fail: mutex_unlock(®ulator_list_mutex); - kfree(new_node->dev_name); + kfree_const(new_node->dev_name); kfree(new_node); return -EBUSY; } @@ -1794,7 +1794,7 @@ static void unset_regulator_supplies(struct regulator_dev *rdev) list_for_each_entry_safe(node, n, ®ulator_map_list, list) { if (rdev == node->regulator) { list_del(&node->list); - kfree(node->dev_name); + kfree_const(node->dev_name); kfree(node); } } -- 2.39.2