
Sorry for resurrecting old thread...
On Thu, Jan 06, 2022 at 02:29:58PM +0200, Andy Shevchenko wrote:
On Fri, Dec 17, 2021 at 5:45 PM Lucas Tanure tanureal@opensource.cirrus.com wrote:
Add support for CS35L41 using a new separated driver that can be used in all upcoming designs
...
/* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use devm version */
Can you elaborate why devm can't be used?
cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index,
Please, do not dereference fwnode pointers. Also, why can't you use the device instead of fwnode?
We are doing "acpi_dev_put(adev);" a few lines above, so using adev in the call to fwnode_gpiod_get_index() is technically use-after-free, isn't it?
Also, why can't we do
cs35l41->reset_gpio = gpiod_get_index(acpi_dev, "reset", cs35l41->index, GPIOD_OUT_LOW);
since acpi_dev is device structure corresponding to adev and we are getting the rest of the properties from it?
I saw downthread that there was supposed to be a patch addressing several issues raised by Andy, was it ever submitted?
Thanks.