* Stephen Warren wrote: > Thierry Reding wrote at Tuesday, November 22, 2011 11:58 PM: > > * Stephen Warren wrote: > > > module_platform_drive saves some boiler-plate code. > > > > > > The devm_ APIs remove the need to manually clean up allocations, > > > thus removing some code. > ... > > > static int __devexit tegra_das_remove(struct platform_device *pdev) > > > { > > > - struct resource *res; > > > - > > > if (!das) > > > return -ENODEV; > > > > > > - platform_set_drvdata(pdev, NULL); > > > - > > [...] > > > > Setting the driver data to NULL may still be a good idea. > > When Mark Brown reviewed the TrimSlice machine driver, he mentioned that > clearing the drvdata was pointless; nothing should be using it when the > device is not created. > > As background, soon after that, I modified the tegra_wm8903.c machine > driver along the same lines, but evidently didn't update tegra_das.c > in a similar way, but would have if I'd been paying attention... Thinking about this some more I have to agree. The only one using the driver data would be the driver, which in turn shouldn't be doing anything with it after remove is called. I was just commenting on it because I've seen it done in a lot of drivers and thought it was common (best) practice. Thierry
Attachment:
pgpVvJimPO59S.pgp
Description: PGP signature