Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13289010rwl; Wed, 4 Jan 2023 06:14:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXvBa43u86916lLKo1THx5NyRmUsyp0SvoWd8puXFZuT6aLhLS8x77LEzsn5NGn49ggRSI1t X-Received: by 2002:a17:906:d052:b0:7be:e26a:6104 with SMTP id bo18-20020a170906d05200b007bee26a6104mr42340666ejb.52.1672841684055; Wed, 04 Jan 2023 06:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672841684; cv=none; d=google.com; s=arc-20160816; b=XS/aQmeT01eMcgwohx7xyqDsuNhp8opsJxz+Z3UirluEuNTMyiosIvHy2sNRm8WESq BTW7bI8Aa8Y1nz42W14VJ0DYWRdmTV9oQ0zPz5NcaFAgzqyvqMavJoRTETa3l89hYqKU iRmdZxMRMMTd9UtfsybtJKNP1Lpf+5L9i76HM8A+Mk0JoS/85sii51Ahw3uBgHMD26Dl DgFo63mtOeknORp5ojWU7WQYyIrnBcaGHLuen+aUZ1Q/krQoYD2by3QXzfJBtrd69PVL GmERGVJ2MkFuSu3H7voaY+VyW0rX4Kb+2jeCPpMmCoSXr+zxNER2X/K9fqJPYGGNmk6V wkEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WTCuWCpVhSIx7eeKkIH6/q53iAnMWENW1ozPuPPgSq4=; b=Xq3rHroz7zBCy6WU86el3EYDnmxVdIk9f+WyLpbzKZvn2bx/DJrQKSl4hFttxN82qp lrBy2pPW49yP6Hv2fSaTarvYRLvMJOT5h8FWgcaGTCZ97yMx91T4hWIiBcbhkxPHfiDC 0LcmngCmoYJjG5craQ4oIaROLaccO791uuktYhzSvuQ0hzlAlTSw/5p0X1HAVLdpYAGV OtcPsiLqlgKTLYJ2UmHKbLjACQaYuNTZB1DCqBLNuOtZTpeo8Hzp9AJuzqNMNHxy5BrG uQ1YMkVinIhXqDzyA94xLJWSj55Ea5RsL1y1+ia9d528Er1yuwYwUVulfQ59+vwGBWAP WqEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gs8F77rz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ae1-20020a17090725c100b007c1600359ecsi14265027ejc.441.2023.01.04.06.14.30; Wed, 04 Jan 2023 06:14:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gs8F77rz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234998AbjADNkc (ORCPT + 57 others); Wed, 4 Jan 2023 08:40:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjADNkM (ORCPT ); Wed, 4 Jan 2023 08:40:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 414E31F9; Wed, 4 Jan 2023 05:40:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4249B815EB; Wed, 4 Jan 2023 13:40:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D8EC433D2; Wed, 4 Jan 2023 13:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672839608; bh=6RPhGmZBE71CH85bdeJy1dx/jV8rHmJ6XO+Ern62lKs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gs8F77rztURAEf8MKD5C1YBEKaa82rFqsFfeb5D59iVj64bfLI+jUC3r1f+l71P84 oU2p0kQK1ttDHHNcUd6yq9oC3uqjDWW2mgj4G/MAJPAOa8SKjDTnWl5d8biAXl7Wwb RRpfx3y+GHSyD9VieHs+48LLQl9ZZRksNhouRewp9SURTqoJqfwgV+b6uXFWKrDs5a vTlTeYPFohwTbQ8Ds5vB2B86xBy03yAbwkfoch6EL/uqXT2ZcZjGfiRvHNIAbS2chG VG64FXR6CcuTywWpZLe4D9oZiHOeLrZJlR8eaCGNxyNXysuAj6X0MSQ7elm0k/w6Ji pzTpQBHATHAiA== Date: Wed, 4 Jan 2023 13:40:04 +0000 From: Conor Dooley To: Geert Uytterhoeven Cc: Michael Turquette , Stephen Boyd , Claudiu Beznea , Conor Dooley , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: microchip: mpfs-ccc: Use devm_kasprintf() for allocating formatted strings Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ruz8Lc2+jwA+2Ea0" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Ruz8Lc2+jwA+2Ea0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 04, 2023 at 02:26:53PM +0100, Geert Uytterhoeven wrote: > Hi Conor, >=20 > On Tue, Jan 3, 2023 at 6:32 PM Conor Dooley wrote: > > I half wonder if this should actually have a fixes tag too. Since it > > used what came after the @ in $full_name, it'd be possible to create > > (an incorrect) DTS that would lead to a clash between pll names & > > therefore probe would fail. > > The tag would be: > > Fixes: d39fb172760e ("clk: microchip: add PolarFire SoC fabric clock su= pport") >=20 > But I don't change any of that in my patch? > /me confused. The numbers in there were chosen to fit exactly what is in mpfs.dtsi (IOW the correct node address), so doing @@ -201,14 +200,13 @@ static int mpfs_ccc_register_plls(struct device *dev,= struct mpfs_ccc_pll_hw_clo =20 for (unsigned int i =3D 0; i < num_clks; i++) { struct mpfs_ccc_pll_hw_clock *pll_hw =3D &pll_hws[i]; - char *name =3D devm_kzalloc(dev, 18, GFP_KERNEL); =20 - if (!name) + pll_hw->name =3D devm_kasprintf(dev, GFP_KERNEL, "ccc%s_pll%u", + strchrnul(dev->of_node->full_name, '@'), i); + if (!pll_hw->name) return -ENOMEM; =20 pll_hw->base =3D data->pll_base[i]; - snprintf(name, 18, "ccc%s_pll%u", strchrnul(dev->of_node->full_name, '@'= ), i); - pll_hw->name =3D (const char *)name; pll_hw->hw.init =3D CLK_HW_INIT_PARENTS_DATA_FIXED_SIZE(pll_hw->name, pll_hw->parents, &mpfs_ccc_pll_ops, 0); means that we no longer have to worry that someone would provide a device tree with a node address that would make "ccc_pll" exceed 18 characters. If that happened, the would be cut off & both pll 0 & 1 would be named identically. If that happens, pll1 would fail to register. Or am I misunderstanding something? Probably am.. Thanks, Conor. --Ruz8Lc2+jwA+2Ea0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCY7WBtAAKCRB4tDGHoIJi 0nJlAP0ehynrTFuwhxiPLMmtmC70nbFReqFv+jOE3ZccM7+A0AD/QybFXMjcM0ug EYLfXR2feFYwXb7Mrqs0dstLrI08vQg= =Z1hJ -----END PGP SIGNATURE----- --Ruz8Lc2+jwA+2Ea0--