From patchwork Sat Feb 17 07:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 202579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp194762dyc; Fri, 16 Feb 2024 23:32:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVtgOTZd/scK0LRcMdge2KVZhXFQ1s2Jo1pCgyOp0KfLE3BCQvN8pL4HDZ9chdQdjG3hPmq6H1I8SjxLferbyCw/vy1/g== X-Google-Smtp-Source: AGHT+IE8Whp9V9/x2yUXnpk8P0QXamWn9jSYpUgUnNqWTjYNgBAUXa0JH7INi2YeJEoZ06bicZ0S X-Received: by 2002:a17:906:f44:b0:a3d:d7f1:35fd with SMTP id h4-20020a1709060f4400b00a3dd7f135fdmr3142705ejj.9.1708155159278; Fri, 16 Feb 2024 23:32:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708155159; cv=pass; d=google.com; s=arc-20160816; b=PtdaxuWUMyIyoDEhp6w+mso1+PLRX2qSxmRxKSlSHyXv3AsBIVkDXJ16DBjsj6nNW8 ASPeJ3xquCajVMQUUnp0A+aVHTQ71cpt8pVzeSecRGiTZKD5M062zFsa0WPwHTKpy/I6 O6PPMKJ0i+TCorrAp16nLz1+tI7brfDd1qpvwWvkohghplY0fSYM6o3FfiyraVUu/2iQ O5JaTWAo3sbKwB2X442yCfz9QsppgF35sg/AT/nHgZo6GqQMq5sQ8q8Scd2bUlEk/zxu uzMCad5JIDGn0NjatyTRNIoOasoVFkX6TKJL9EGNMB6OF5PS/uwaECncRoELU43KoUom UCFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5vKyutSF5vbJeBYhO1altd+rC0SgjetnS/HWHgINoOs=; fh=AkZTJ1vQdqOJlAfk7xXIPyq0VWZ2grm6Iy/f8NX2w48=; b=fFPvWk2RM7KJte2R/eJiA/J/9XwLQYfFFobo0bM3e6EIndbt6elh0gmcodrIN240sA qCBh6HbVJ3flUX5KzL3OFRCuDllYlH7rDyO8JRxby6LgRNMTEK2kRWeNFYRNPywpMrKz LnJcssLK2QfaE2+ZYxszzL3KHn6KRpylSZxpX7cUVftHX3OnArvh05GpFs2EegNswIVx aFLeS8RKwF0x3AcIkTQAZat+b1LPXF1FhKxbU4JROr9cpeAMOP8HaiEhodhWewJcHPdx fHnAuhfQa2CdcMHkY+7Tnw8b+UWZEAthFfQAcEwgVdaANi9xr1Yq5mO/f/FyI9I69p3Z sQ2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=PuMWz8ZT; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-69715-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69715-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h16-20020a170906719000b00a3d1df335edsi628977ejk.988.2024.02.16.23.32.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 23:32:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69715-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=PuMWz8ZT; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-69715-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69715-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr 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 am.mirrors.kernel.org (Postfix) with ESMTPS id DEE3D1F22315 for ; Sat, 17 Feb 2024 07:32:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 585CB1D53C; Sat, 17 Feb 2024 07:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="PuMWz8ZT" Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FCF31CAB8 for ; Sat, 17 Feb 2024 07:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708155122; cv=none; b=FpWPKO6AK/qucmH1lEKsql72PrYl0COrhtS3S8Km8g9xLgcnlXYLDA1NSuyKvg2EI3CgnEKh+PI4u4Rs4CiDMgEL7rZ++7P5HuqU0sNZg+JeHNDVyPQrJnJGmmfDBA4ikzmgP/0kWUgdQzb6+JxiaksB00iGCEuQVuYL6wPkIVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708155122; c=relaxed/simple; bh=3wE0OY454mubqM9kqU3kHG80CJKYun5q3sKzkDVg2vs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QdpjQe1rFbc3hTB26BTEGsdJE9XEjg5j1o6xvZjojeK/ivj7gZOuPA+MXvZbZIv+Wy2nujPC1VkZXM3MxtQSXeDAvBPrQDbtHnE25KK3WJLnJ8LdmeSnMZ8H13OisBBJK/f3PoiLo14G9L1Dbp8ekuFsPGRg01VW30PJDWffiD0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=PuMWz8ZT; arc=none smtp.client-ip=80.12.242.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id bF9rr7RBlRhCJbF9tr0LVY; Sat, 17 Feb 2024 08:30:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1708155049; bh=5vKyutSF5vbJeBYhO1altd+rC0SgjetnS/HWHgINoOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PuMWz8ZTELKEI8vMRbQe6sW8sB9UIkS8KOjwo8ppSOudEaxa0Lgmi5UFIpWeQIVYT Hg8au41CCBRXki8wWZso2guY1wUC/4Mpf9rpSHiDTqjE6ojSzFGiVYeurLICDSeOfK E1V27m6vMF9Y8tKWjykO3djjzhW9CCLiZv23uFgbmH15+Wp+kmzYATvvcH1vDXlGt0 RP2krzxKEzp5Q+T8aY0w85zPLl6bRvtFMKobcgCoPOdU7R8lTydn4Dbr63omIqg8yb b/ySRMCSRFaOeD5yl6/hYQuMj6ITg227LEOy9bZmYLlFwrQTnHW288nsF53SWkgXvd J1wZeKzEafSaA== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 17 Feb 2024 08:30:49 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Marcel Holtmann , Luiz Augusto von Dentz Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-bluetooth@vger.kernel.org Subject: [PATCH 2/2] Bluetooth: btbcm: Use devm_kstrdup() Date: Sat, 17 Feb 2024 08:30:42 +0100 Message-ID: <272fb12e9392c0bc6fead23931f98ea45bf6fc69.1708154999.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.43.2 In-Reply-To: <79b9c9d9f86b4c573f0d3f2dac0a6fc9e6024058.1708154999.git.christophe.jaillet@wanadoo.fr> References: <79b9c9d9f86b4c573f0d3f2dac0a6fc9e6024058.1708154999.git.christophe.jaillet@wanadoo.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791130504143314894 X-GMAIL-MSGID: 1791130504143314894 Use devm_kstrdup() instead of hand-writing it. It is less verbose. Signed-off-by: Christophe JAILLET --- drivers/bluetooth/btbcm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 01d2343b4978..f9a7c790d7e2 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -544,7 +544,6 @@ static const char *btbcm_get_board_name(struct device *dev) struct device_node *root; char *board_type; const char *tmp; - int len; root = of_find_node_by_path("/"); if (!root) @@ -554,9 +553,7 @@ static const char *btbcm_get_board_name(struct device *dev) return NULL; /* get rid of any '/' in the compatible string */ - len = strlen(tmp) + 1; - board_type = devm_kzalloc(dev, len, GFP_KERNEL); - strscpy(board_type, tmp, len); + board_type = devm_kstrdup(dev, tmp, GFP_KERNEL); strreplace(board_type, '/', '-'); of_node_put(root);