Re: [PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-24 Thread Gen Zhang
On Fri, May 24, 2019 at 04:36:54PM +0100, Jon Hunter wrote: > There could well be cases where you need to explicitly call > devm_kfree(), but having a quick glance at the example above, I don't > see why you would call devm_kfree() here and yes looks like that code > could be simplified

Re: [PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-24 Thread Jon Hunter
On 24/05/2019 16:00, Gen Zhang wrote: > On Fri, May 24, 2019 at 03:47:34PM +0100, Jon Hunter wrote: >> >> On 24/05/2019 15:33, Gen Zhang wrote: >>> On Fri, May 24, 2019 at 09:33:13AM +0100, Jon Hunter wrote: On 24/05/2019 01:50, Gen Zhang wrote: > In tegra_wm9712_driver_probe(),

Re: [PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-24 Thread Gen Zhang
On Fri, May 24, 2019 at 03:47:34PM +0100, Jon Hunter wrote: > > On 24/05/2019 15:33, Gen Zhang wrote: > > On Fri, May 24, 2019 at 09:33:13AM +0100, Jon Hunter wrote: > >> > >> On 24/05/2019 01:50, Gen Zhang wrote: > >>> In tegra_wm9712_driver_probe(), 'machine->codec' is allocated by > >>>

Re: [PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-24 Thread Jon Hunter
On 24/05/2019 15:33, Gen Zhang wrote: > On Fri, May 24, 2019 at 09:33:13AM +0100, Jon Hunter wrote: >> >> On 24/05/2019 01:50, Gen Zhang wrote: >>> In tegra_wm9712_driver_probe(), 'machine->codec' is allocated by >>> platform_device_alloc(). When it is NULL, function returns ENOMEM. >>> However,

Re: [PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-24 Thread Gen Zhang
On Fri, May 24, 2019 at 09:33:13AM +0100, Jon Hunter wrote: > > On 24/05/2019 01:50, Gen Zhang wrote: > > In tegra_wm9712_driver_probe(), 'machine->codec' is allocated by > > platform_device_alloc(). When it is NULL, function returns ENOMEM. > > However, 'machine' is allocated by devm_kzalloc()

Re: [PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-24 Thread Jon Hunter
On 24/05/2019 01:50, Gen Zhang wrote: > In tegra_wm9712_driver_probe(), 'machine->codec' is allocated by > platform_device_alloc(). When it is NULL, function returns ENOMEM. > However, 'machine' is allocated by devm_kzalloc() before this site. > Thus we should free 'machine' before function ends

[PATCH] tegra_wm9712: Fix a memory leaking bug in tegra_wm9712_driver_probe()

2019-05-23 Thread Gen Zhang
In tegra_wm9712_driver_probe(), 'machine->codec' is allocated by platform_device_alloc(). When it is NULL, function returns ENOMEM. However, 'machine' is allocated by devm_kzalloc() before this site. Thus we should free 'machine' before function ends to prevent memory leaking. Further, we should