diff mbox

PCI: endpoint: not need to free epf_test

Message ID 1501728251-196637-1-git-send-email-shawn.lin@rock-chips.com
State Changes Requested
Headers show

Commit Message

Shawn Lin Aug. 3, 2017, 2:44 a.m. UTC
It's from devm_kzalloc. so not need to free it when removing
the test driver.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Just compile only. Unless I missed something when
trying to support ep mode for pcie-rockchip and find this
issue.

 drivers/pci/endpoint/functions/pci-epf-test.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Bjorn Helgaas Aug. 14, 2017, 9:12 p.m. UTC | #1
On Thu, Aug 03, 2017 at 10:44:11AM +0800, Shawn Lin wrote:
> It's from devm_kzalloc. so not need to free it when removing
> the test driver.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Kishon?

> ---
> Just compile only. Unless I missed something when
> trying to support ep mode for pcie-rockchip and find this
> issue.
> 
>  drivers/pci/endpoint/functions/pci-epf-test.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 53fff80..4e3abbd 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -455,9 +455,6 @@ static int pci_epf_test_probe(struct pci_epf *epf)
>  
>  static int pci_epf_test_remove(struct pci_epf *epf)
>  {
> -	struct pci_epf_test *epf_test = epf_get_drvdata(epf);
> -
> -	kfree(epf_test);
>  	return 0;
>  }
>  
> -- 
> 1.9.1
> 
>
Kishon Vijay Abraham I Aug. 16, 2017, 2:09 p.m. UTC | #2
Hi,

On Tuesday 15 August 2017 02:42 AM, Bjorn Helgaas wrote:
> On Thu, Aug 03, 2017 at 10:44:11AM +0800, Shawn Lin wrote:
>> It's from devm_kzalloc. so not need to free it when removing
>> the test driver.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> 
> Kishon?

While the patch itself is correct, I'd like to make ->remove callback optional
so that function drivers need not populate empty 'remove' callback functions.

I have a few endpoint patches in my local tree which I'm planning to send in a
couple of days. I'll send this patch along with that series while making the
above mentioned modifications.

Thanks
Kishon
diff mbox

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 53fff80..4e3abbd 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -455,9 +455,6 @@  static int pci_epf_test_probe(struct pci_epf *epf)
 
 static int pci_epf_test_remove(struct pci_epf *epf)
 {
-	struct pci_epf_test *epf_test = epf_get_drvdata(epf);
-
-	kfree(epf_test);
 	return 0;
 }