[alsa-devel] [PATCH v2 10/13] soundwire: cdns: Add port routines

Vinod Koul vinod.koul at intel.com
Fri Apr 6 10:55:25 CEST 2018


On Thu, Apr 05, 2018 at 07:19:43PM -0500, Pierre-Louis Bossart wrote:
> On 4/5/18 11:48 AM, Vinod Koul wrote:

> >+static int cdns_allocate_pdi(struct sdw_cdns *cdns,
> >+			struct sdw_cdns_pdi **stream,
> >+			u32 start, u32 num, u32 pdi_offset)
> 
> the start parameter doesn't seem to be used, remove and remove the useless
> zeroes in all the calls to this routine?

Yes this seems to be the case, will fix

> >+
> >+pdm_error:
> >+	kfree(stream->bd);
> >+	kfree(stream->in);
> >+	kfree(stream->out);
> >+
> >+pcm_error:
> >+	stream = &cdns->pcm;
> >+	kfree(stream->bd);
> >+	kfree(stream->in);
> >+	kfree(stream->out);
> 
> call me a grumpy old fart if you want, I still don't like people freeing
> memory they never allocated. It may be legal but it's sloppy.

Actually looking at it freeing is not required as we are doing devm_
allocations, so this can be removed and return error should do the trick and
we propagate the error and cleanup, thanks for the catch

-- 
~Vinod


More information about the Alsa-devel mailing list