spi: npcm-pspi: Fix wrong priv pointer
authorAxel Lin <axel.lin@ingics.com>
Tue, 1 Jan 2019 14:10:53 +0000 (22:10 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 3 Jan 2019 12:27:17 +0000 (12:27 +0000)
In npcm_pspi_probe(), current code set platform_set_drvdata(pdev, master);
so in npcm_pspi_remove() platform_get_drvdata(pdev) will return pointer to
master rather than priv. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-npcm-pspi.c

index e1dca79b9090358d36ed20d5239c4b05a2ed0d6d..734a2b9569596fea7117a1e6150cbedeb478381f 100644 (file)
@@ -465,7 +465,8 @@ out_master_put:
 
 static int npcm_pspi_remove(struct platform_device *pdev)
 {
-       struct npcm_pspi *priv = platform_get_drvdata(pdev);
+       struct spi_master *master = platform_get_drvdata(pdev);
+       struct npcm_pspi *priv = spi_master_get_devdata(master);
 
        npcm_pspi_reset_hw(priv);
        clk_disable_unprepare(priv->clk);