From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viresh Kumar Subject: Re: [PATCH] soc: qcom: update config dependencies for QCOM_RPMPD Date: Thu, 24 Jan 2019 12:15:15 +0530 Message-ID: <20190124064515.yimgprg5hzsfghc6@vireshk-i7> References: <20190118044801.7312-1-rnayak@codeaurora.org> <154783318835.169631.6614930101893188915@swboyd.mtv.corp.google.com> <25f46403-e78e-271b-c4d0-13b4623846b3@roeck-us.net> <864348fb-3d06-7b4b-cc82-17c96b7ce219@codeaurora.org> <20190122100854.nuepsz5ddbt4jda4@vireshk-i7> <57f73ea8-3be4-470c-1ef8-d870af605347@codeaurora.org> <20190123111630.s33rzxn7o3mr6kks@vireshk-i7> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Guenter Roeck Cc: Rajendra Nayak , Stephen Boyd , andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Ulf Hansson List-Id: linux-arm-msm@vger.kernel.org On 23-01-19, 06:22, Guenter Roeck wrote: > See Documentation/kobject.txt. > > "One important point cannot be overstated: every kobject must have a > release() method, and the kobject must persist (in a consistent state) > until that method is called. If these constraints are not met, the code is > flawed. Note that the kernel will warn you if you forget to provide a > release() method. Do not try to get rid of this warning by providing an > "empty" release function. > > If all your cleanup function needs to do is call kfree(), then you must > create a wrapper function which uses container_of() to upcast to the correct > type (as shown in the example above) and then calls kfree() on the overall > structure." Guenter, you are of course correct but I am not sure what else we can do here. In the most common case device & kobject are allocated along with the real entity, like struct genpd here, and we free those from the release routine (i.e. kfree(genpd)). But in our case most of the times the genpd is created statically by platform drivers and not by the genpd core, and so we can't free it from release(). Over that the genpd->dev is only used by the OPP core currently and the device isn't even registered with the device core. -- viresh