From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ivan T. Ivanov" Subject: Re: [PATCH] mfd: qcom-spmi-pmic: Add support for more chips versions Date: Tue, 04 Nov 2014 17:49:55 +0200 Message-ID: <1415116195.29957.16.camel@mm-sol.com> References: <1415108003-16387-1-git-send-email-iivanov@mm-sol.com> <5458EB64.3030203@mm-sol.com> <1415114567.29957.14.camel@mm-sol.com> <5458F039.3030809@mm-sol.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from ns.mm-sol.com ([37.157.136.199]:48443 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbaKDPti (ORCPT ); Tue, 4 Nov 2014 10:49:38 -0500 In-Reply-To: <5458F039.3030809@mm-sol.com> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Stanimir Varbanov Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Samuel Ortiz , Lee Jones , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org On Tue, 2014-11-04 at 17:26 +0200, Stanimir Varbanov wrote: > On 11/04/2014 05:22 PM, Ivan T. Ivanov wrote: > > On Tue, 2014-11-04 at 17:06 +0200, Stanimir Varbanov wrote: > > > > + snprintf(compatible, ARRAY_SIZE(compatible), "qcom,%s-v%d.%d", > > > > + name, major, minor); > > > > + prop = kzalloc(sizeof(*prop), GFP_KERNEL); > > > > + if (prop) { > > > > + prop->name = kstrdup("compatible", GFP_KERNEL); > > > > + prop->value = kstrdup(compatible, GFP_KERNEL); > > > > + prop->length = strlen(prop->value); > > > > + of_update_property(root, prop); > > > > > > of_update_property can fail, check the returned value. > > > > Same thing as above, but probably allocated memory at least can be freed. > > might be better idea to use devm_kzalloc and devm_kstrdup? > compatible property is attached to device not to driver, so memory should be there even after driver is unloaded, I think. Regards, Ivan