From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96F4CC433F5 for ; Fri, 6 May 2022 07:45:42 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KvjKd04DJz3cDT for ; Fri, 6 May 2022 17:45:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=JEfgnl+V; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=bootlin.com (client-ip=217.70.183.193; helo=relay1-d.mail.gandi.net; envelope-from=clement.leger@bootlin.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=JEfgnl+V; dkim-atps=neutral X-Greylist: delayed 144179 seconds by postgrey-1.36 at boromir; Fri, 06 May 2022 17:45:08 AEST Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KvjK05sQzz2xF8 for ; Fri, 6 May 2022 17:45:05 +1000 (AEST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7B0FE240010; Fri, 6 May 2022 07:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1651823100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PGzNB4W4WfGK9PIJGUcSrH2CG36WKRbfkNH89DZr2pM=; b=JEfgnl+VgeNXkCi9WmNelq7MqYYGqUqE3V8lLJ1ouTRKtV4ZB+l7Y+vuBy9sONaFi/4Tss TpNmuLn+7xCOsMnTcXpQp1TdMztRBXLDwUtfL8Dx3WvdHairjaIGwDjd03qf61hDvOYOPW 3RsFKkZrQ8O7/c4fviwabahTxavVQ4NGYV990U6lWeMHvqUY12Xd0XqvXr0HutdQ7f818m dUq4rLktDIy/KAhfqcn+z7ZwkcgRDZUJmfeKxinV0HLx/aO0hkBoR5fG8lUSmX3a+uOYpL kB0dkTCQE4coldMuQ5k4HA2OuH3CMNo8/V1HkFe2rUkGwHhbSEWoKk2Bnq8FWQ== Date: Fri, 6 May 2022 09:43:39 +0200 From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= To: Rob Herring Subject: Re: [PATCH 1/3] of: dynamic: add of_property_alloc() and of_property_free() Message-ID: <20220506094339.55b8aa63@fixe.home> In-Reply-To: References: <20220504154033.750511-1-clement.leger@bootlin.com> <20220504154033.750511-2-clement.leger@bootlin.com> <9e470414-67a5-10ce-95eb-f8093fde70d4@csgroup.eu> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nathan Lynch , "devicetree@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Ohhoon Kwon , David Hildenbrand , Steen Hegelund , Daniel Henrique Barboza , YueHaibing , "linux-kernel@vger.kernel.org" , Paul Mackerras , "Aneesh Kumar K.V" , Thomas Petazzoni , Allan Nielsen , Andrew Morton , Laurent Dufour , Frank Rowand , Horatiu Vultur , David Gibson Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le Thu, 5 May 2022 12:37:38 -0500, Rob Herring a =C3=A9crit : > > > =20 > > > - /* mark the property as dynamic */ > > > - of_property_set_flag(new, OF_DYNAMIC); > > > + prop->value =3D kzalloc(alloc_len, allocflags); > > > + if (!prop->value) > > > + goto out_err; > > > =20 > > > - return new; > > > + if (value) > > > + memcpy(prop->value, value, value_len); =20 > >=20 > > Could you use kmemdup() instead of kzalloc+memcpy ? =20 >=20 > I'd prefer there be 1 alloc for struct property and value instead of 2.=20 > And maybe 'name' gets rolled into it too, but that gets a bit more=20 > complicated to manage I think.=20 At least for value it should be easy indeed. i'll check what I can do for the name. >=20 > With memcpy, note this series[1]. Ok, good to know, should I base my series on that one ? >=20 > Rob >=20 > [1] https://lore.kernel.org/all/20220504014440.3697851-30-keescook@chromi= um.org/ --=20 Cl=C3=A9ment L=C3=A9ger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com