From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mauro Carvalho Chehab Date: Thu, 03 Sep 2020 09:05:09 +0000 Subject: Re: [PATCH][next] staging: media: atomisp: fix memory leak of object flash Message-Id: <20200903110509.4542cdad@coco.lan> List-Id: References: <20200902165852.201155-1-colin.king@canonical.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andy Shevchenko Cc: "open list:STAGING SUBSYSTEM" , Greg Kroah-Hartman , Linus Walleij , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List , Sakari Ailus , Colin King , Linux Media Mailing List Em Wed, 2 Sep 2020 21:15:31 +0300 Andy Shevchenko escreveu: > On Wed, Sep 2, 2020 at 8:02 PM Colin King wrote: > > > > From: Colin Ian King > > > > In the case where the call to lm3554_platform_data_func returns an > > error there is a memory leak on the error return path of object > > flash. Fix this by adding an error return path that will free > > flash and rename labels fail2 to fail3 and fail1 to fail2. > > > > Wouldn't be proper fix to move to devm_kmalloc() and return > dev_err_probe() where appropriate? Actually, we prefer not using devm_*() at media subsystem. Once we started migrating alloc stuff to use it. We end needing to revert those, as it caused side effects related to lifecycle management: some object were de-allocating too late. Others with multiple interfaces (USB, pci) had even worse troubles. Thanks, Mauro