Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4813151iob; Mon, 9 May 2022 02:09:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZR6Xitq0Q+G+oX6D6PdpwLCx9iJKYi0Zr63tum9qFbKtMJM3ezraKzOImx2rgYS005mNi X-Received: by 2002:a65:6e47:0:b0:3c6:7d47:ddc8 with SMTP id be7-20020a656e47000000b003c67d47ddc8mr7802952pgb.157.1652087371046; Mon, 09 May 2022 02:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652087371; cv=none; d=google.com; s=arc-20160816; b=LQQnev8lVmbGcXkRHVWC0eGrriqARXHEKa56/ev8zl8chFcL5D0dLXP7Cy0p95X+TQ 20PMik7KZKxgtCt1fLowh71HklQCTlcmWRNb0BFom+wM+oC7xOumPAyp8QK5uDmOvdd6 RcEYtK3Z8CaS/HGRTDCOvnv86NRd5iD8ALn2hhogppxGUesIU5m3MTtmAKioBnRaRbSj 8bNBnakobm8scoBp7L79etlwB3W1EmP+1BHP3/8VYoT4ZEAaDyV0I2DcxeBLHR7IQmVP RZkRR6Vcn0Wp3bjRJMpEnRgZlE4qVnh1U3gv6bQxt/1xV61sXdWgrmKJuo2Bui0HPRn8 HR2Q== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=PGzNB4W4WfGK9PIJGUcSrH2CG36WKRbfkNH89DZr2pM=; b=tRz3g8H4pBuX0nFlH0i/k8x8EE2D9UsTS3Af7FEgciYRPEgf61gSqsuf8kcOvUPUim DXBKppJh6UsT84GdxhI0Ww3OBomNrToAt5qd8UQby5eJemthDJkgJZv+RWui3JLcqKuI OwbcQyVhTyn5boV77aSZSpPbYgc+GhxkV4qHQlqwllrpmC0UwV/4w0M/v1G0IYBibEP2 9oXDBQOXfRN7f8uyVe97XlQh/mbcmRPeXKf31qmR18KWzaG5lAIM9dxqX/WdOjG3W+3q wZvs6IIJeXSs+1W2UXgGcxHRI310N1nh6IK34cwXPCNRZx4XFoWlsDPGgbLB1+sGAb1P HdkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JEfgnl+V; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h13-20020a63574d000000b003c6115ef99esi13982210pgm.49.2022.05.09.02.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:09:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JEfgnl+V; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1844518B976; Mon, 9 May 2022 01:56:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386614AbiEFHst (ORCPT + 99 others); Fri, 6 May 2022 03:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236048AbiEFHsp (ORCPT ); Fri, 6 May 2022 03:48:45 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76BF8674D0; Fri, 6 May 2022 00:45:02 -0700 (PDT) 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 Cc: Christophe Leroy , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Frank Rowand , Nathan Lynch , Laurent Dufour , Daniel Henrique Barboza , David Gibson , Andrew Morton , David Hildenbrand , Ohhoon Kwon , "Aneesh Kumar K.V" , YueHaibing , "devicetree@vger.kernel.org" , Steen Hegelund , "linux-kernel@vger.kernel.org" , Allan Nielsen , Thomas Petazzoni , "linuxppc-dev@lists.ozlabs.org" , Horatiu Vultur 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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