Skip to content

Commit

Permalink
spi: omap2-mcspi: Fix the error handling in probe
Browse files Browse the repository at this point in the history
The kfree() is taken care of by the spi core (spi_master_release() function)
that is called once the last reference to the underlying struct device has
been released. So the driver need not call kfree.

Also the put was missed in some of the error handling fix the same.
There by fixing the missing device_put in some of the error paths.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Shubhrajyoti D authored and Mark Brown committed Aug 4, 2012
1 parent 10ce047 commit 37a2d84
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/spi/spi-omap2-mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,18 +1228,16 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)

status = spi_register_master(master);
if (status < 0)
goto err_spi_register;
goto disable_pm;

return status;

err_spi_register:
spi_master_put(master);
disable_pm:
pm_runtime_disable(&pdev->dev);
dma_chnl_free:
kfree(mcspi->dma_channels);
free_master:
kfree(master);
spi_master_put(master);
platform_set_drvdata(pdev, NULL);
return status;
}
Expand Down

0 comments on commit 37a2d84

Please sign in to comment.