From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: Re: [RFC 0/4] clk/driver: platform: Fix kfree() of const memory on setting driver_override Date: Wed, 20 Feb 2019 14:01:42 -0800 Message-ID: <155070010208.77512.17397936280518534534@swboyd.mtv.corp.google.com> References: <1550484960-2392-1-git-send-email-krzk@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: Russell King , Mark Brown , Linux Kernel Mailing List , linux-spi , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sylwester Nawrocki , Tomasz Figa , Chanwoo Choi , Michael Turquette , Kukjin Kim , Andy Gross , David Brown , Srinivas Kandagatla , "linux-samsung-soc@vger.kernel.org" , linux-clk , Linux ARM , linux-a To: Geert Uytterhoeven , Krzysztof Kozlowski Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-spi.vger.kernel.org Quoting Krzysztof Kozlowski (2019-02-18 03:14:29) > On Mon, 18 Feb 2019 at 11:40, Geert Uytterhoeven w= rote: > > > > Hi Krzysztof, > > > > On Mon, Feb 18, 2019 at 11:27 AM Krzysztof Kozlowski = wrote: > > > The problem > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > Several device types (platform, amba, spi etc.) provide a driver_over= ride > > > field. On sysfs store or during device removal, they kfree() the > > > existing value. > > > > > > However the users are unaware of this and set the driver_override lik= e: > > > > > > pdev->driver_override =3D "exynos5-subcmu"; > > > > > > which obviously leads to error. > > > > IMHO driver_override is not meant to be set by a driver, only from user= space, > > for binding the device to vfio (is there another use case?). > > > > > clk: samsung: exynos5: Fix kfree() of const memory on setting > > > driver_override > > > slimbus: ngd: Fix kfree() of const memory on setting driver_override > > > > I see all users set override immediately after allocating a platform de= vice. > > Can't they just allocate a platform device using the override name inst= ead? > > What am I missing? >=20 > For the clk-exynos5-subcmu.c case, driver registers several > sub-devices. Each sub-devices is a clock controller associated with > power domain. I guess the author wanted to have meaningful names of > these sub-devices (DISP, CAM etc. like names of power domains), > instead of just exynos5-subcmu.1, exynos5-subcmu.2 ... >=20 > If driver_override should not be used for such case, then I could > replace it with what you said. Looking at the introduction of the code into the platform bus makes it sound like it was all for vfio devices. If the clk driver doesn't need it for that purpose and can get by with more generic names then it seems best to avoid using it entirely. So can you do that and resend the first patch in this series too? Effectively splitting the clk parts from the larger issue of kfree()ing of const memory.