Skip to content

Commit

Permalink
sata_mv: remove iounmap in mv_platform_remove and use devm_iomap
Browse files Browse the repository at this point in the history
this will fix crash bug when doing rmmod to the driver, this is because the
port_stop function get called later and it could access the device's registers.

Signed-off-by: Saeed Bishara <saeed@marvell.com>
Acked-by: Mark Lord <mlord@pobox.com>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Saeed Bishara authored and Jeff Garzik committed Feb 20, 2008
1 parent 5d44b41 commit f1cb0ea
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/ata/sata_mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2947,7 +2947,8 @@ static int mv_platform_probe(struct platform_device *pdev)
hpriv->n_ports = n_ports;

host->iomap = NULL;
hpriv->base = ioremap(res->start, res->end - res->start + 1);
hpriv->base = devm_ioremap(&pdev->dev, res->start,
res->end - res->start + 1);
hpriv->base -= MV_SATAHC0_REG_BASE;

rc = mv_create_dma_pools(hpriv, &pdev->dev);
Expand Down Expand Up @@ -2979,11 +2980,8 @@ static int __devexit mv_platform_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ata_host *host = dev_get_drvdata(dev);
struct mv_host_priv *hpriv = host->private_data;
void __iomem *base = hpriv->base;

ata_host_detach(host);
iounmap(base);
return 0;
}

Expand Down

0 comments on commit f1cb0ea

Please sign in to comment.