For sata_nv driver in kernel 2.6.21 onward, Inside nv_init_one(),use
'hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);' but
using the kfree(hpriv) to free that data struction in nv_remove_one(),
which will cause system hang when removing the sata_nv module.
Change the 'kfree()' function to 'devm_kfree' will fix this bug.
The patch base on kernel 2.6.22-rc1.
Signed-off-by: Peer Chen <pchen@xxxxxxxxxx>
=====================================
--- linux-2.6.22-rc1/drivers/ata/sata_nv.c.orig
+++ linux-2.6.22-rc1/drivers/ata/sata_nv.c
@@ -1619,7 +1619,7 @@ static void nv_remove_one (struct pci_de
struct nv_host_priv *hpriv = host->private_data;
ata_pci_remove_one(pdev);
- kfree(hpriv);
+ devm_kfree(&pci_dev->dev, hpriv);