Re: [PATCH] mtd: rawnand: denali: Fix a possible resource leak in denali_pci_probe

From: Miquel Raynal
Date: Mon Sep 19 2022 - 11:35:30 EST


Hi,

christophe.jaillet@xxxxxxxxxx wrote on Mon, 1 Aug 2022 20:26:07 +0200:

> Le 01/08/2022 à 10:03, GONG, Ruiqi a écrit :
> > Call pci_release_regions() to retrieve the allocated resource when
> > devm_ioremap() or denali_init() failed.
> >
>
> Hi,
> this is not correct.
>
> First, should you be right, you should also update the .remove() function the same way.
>
> Second, at the beginning there is pcim_enable_device() call.
> This looked like magic to me when I first saw it, but this function makes some pci_ functions work just as it they were pcim_ functions.
>
> See pcim_enable_device() ([1]), at line 2132.
> When pcim_release() ([2]) is called by the framework, then regions are released at line 2079

Interesting, I just see this answer now, please ignore my first comment
then, it's not useful.

Thanks Christophe for the feedback.

Cheers,
Miquèl