Re: [PATCH v3 06/15] platform: goldfish: pipe: Move memory allocation from probe to init
From: Roman Kiryanov
Date: Tue Oct 16 2018 - 16:48:33 EST
> I think we are getting our terms confused here.
>
> "init" usually means module_init(), is that what you are referring to
> here?
This is just a function that probe calls to, goldfish_pipe_device_v2_init.
https://android.googlesource.com/kernel/goldfish/+/android-goldfish-4.14-dev/drivers/platform/goldfish/goldfish_pipe_v2.c#1128
> Why would your probe function know, or care, about versions?
Different driver versions allocate different state.
> How is your probe function learning about the "version" to use here?
writel(PIPE_DRIVER_VERSION, base + PIPE_V2_REG_VERSION);
version = readl(base + PIPE_V2_REG_VERSION);
https://android.googlesource.com/kernel/goldfish/+/android-goldfish-4.14-dev/drivers/platform/goldfish/goldfish_pipe.c#106
> You have to clean up after your probe function failing before you return
> from it.
Are you saying that devm_kzalloc does not free memory if probe fails?
Is this useful?
I can free memory myself then.