On Thu, May 11, 2017 at 07:10:18PM +0900, AKASHI Takahiro wrote: > Luis, > > On Tue, May 02, 2017 at 01:49:12AM -0700, Luis R. Rodriguez wrote: > > > > diff --git a/lib/test_driver_data.c b/lib/test_driver_data.c > > new file mode 100644 > > index 000000000000..488cc6e9eed4 > > --- /dev/null > > +++ b/lib/test_driver_data.c > > ... > > > +static int trigger_config_sync(struct driver_data_test_device *test_dev) > > +{ > > + struct test_config *config = &test_dev->config; > > + int ret; > > + const struct driver_data_req_params req_params_default = { > > + DRIVER_DATA_DEFAULT_SYNC_REQS(config_sync_req_cb, test_dev, > > + DRIVER_DATA_REQ_OPTIONAL | > > + DRIVER_DATA_REQ_KEEP) > > Are these flags always on?
Ah no, indeed they are conditional on the config as with the others. With this kmemleak on the test driver is back to squeaky clean, I had failed to test with kmemleak on the test_driver after these changes, sorry and thanks for picking this up. > > +void free_test_dev_driver_data(struct driver_data_test_device *test_dev) > > +{ > > + kfree_const(test_dev->misc_dev.name); > > + test_dev->misc_dev.name = NULL; > > + vfree(test_dev); > > + test_dev = NULL; > > + driver_data_config_free(test_dev); > > Removing this test module fails. > > The last three lines should be: > driver_data_config_free(test_dev); > vfree(test_dev); Fixed, thanks! > > +} > > + > > +void unregister_test_dev_driver_data(struct driver_data_test_device > > *test_dev) > > +{ > > + wait_for_completion_timeout(&test_dev->request_complete, 5 * HZ); > > + dev_info(test_dev->dev, "removing interface\n"); > > + misc_deregister(&test_dev->misc_dev); > > + kfree(&test_dev->misc_dev.name); > > Don't need this kfree(). Indeed, thanks! Luis