Hi Chris, On Tuesday 31 Jan 2017 13:48:57 Chris Brandt wrote: > On Tuesday, January 31, 2017, Jacopo Mondi wrote: > >> Since one of the benefits of using devm_kzalloc is that if the probe > >> fails and returns an error, all the memory associated with that device > >> will automatically get freed, you 'might' not need this code to free > >> memory. > >> > >> I say might because I'm not sure if returning an error here will kill > >> the driver or not. But, might be interesting to look into. > > > > No, returning an error here would not kill the driver BUT if > > dt_node_to_map fails, dt_free_map is called immediately later [1] > > > > So here we maybe should not use device managed memory as it does not bring > > anything, do not free *map as it is freed later in dt_free_map, but > > release fngrps mux_modes and grpins, as we lose reference to them outside > > the scope of this function. > > > > Do you agree? > > Like you said, there is no benefit one way of the other. > > But, doing a grep of the pinctrl directory, devm_kzalloc is used more by > the other drivers than kzalloc, so maybe we just stick with devm_kzalloc > > (baah goes the sheep) Given that the devm_*() functions incur an overhead, let's use kzalloc/kfree directly. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html