Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions drivers/mtd/spiflash/spi020_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,8 @@ static int spinand_probe(struct platform_device *pdev)

info->pdev = pdev;

info->flash_info = kmalloc(sizeof(struct nvt_nand_flash), GFP_KERNEL);
info->flash_info = devm_kzalloc(&pdev->dev, sizeof(struct nvt_nand_flash),
GFP_KERNEL);
if (!info->flash_info) {
dev_err(&pdev->dev, "failed to allocate nvt_nand_flash\n");
return -ENOMEM;
Expand Down Expand Up @@ -1205,8 +1206,8 @@ static int spinand_probe(struct platform_device *pdev)

static int spinand_remove(struct platform_device *pdev)
{
struct mtd_info *mtd = platform_get_drvdata(pdev);
struct drv_nand_dev_info *info = mtd->priv;
struct drv_nand_dev_info *info = platform_get_drvdata(pdev);
struct mtd_info *mtd = nand_to_mtd(&info->nand_chip);

platform_set_drvdata(pdev, NULL);

Expand All @@ -1216,16 +1217,14 @@ static int spinand_remove(struct platform_device *pdev)

kfree(info->data_buff);

kfree(mtd);
return E_OK;
}

#ifdef CONFIG_PM
static int spinand_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct mtd_info *mtd = platform_get_drvdata(pdev);
struct drv_nand_dev_info *info = mtd->priv;
struct drv_nand_dev_info *info = platform_get_drvdata(pdev);

if (!IS_ERR(info->clk))
clk_disable(info->clk);
Expand All @@ -1235,8 +1234,7 @@ static int spinand_suspend(struct device *dev)
static int spinand_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct mtd_info *mtd = platform_get_drvdata(pdev);
struct drv_nand_dev_info *info = mtd->priv;
struct drv_nand_dev_info *info = platform_get_drvdata(pdev);

clk_enable(info->clk);

Expand Down
14 changes: 6 additions & 8 deletions drivers/mtd/spiflash/spinand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,8 @@ static int spinand_probe(struct platform_device *pdev)

info->pdev = pdev;

info->flash_info = kmalloc(sizeof(struct nvt_nand_flash), GFP_KERNEL);
info->flash_info = devm_kzalloc(&pdev->dev, sizeof(struct nvt_nand_flash),
GFP_KERNEL);
if (!info->flash_info) {
dev_err(&pdev->dev, "failed to allocate nvt_nand_flash\n");
return -ENOMEM;
Expand Down Expand Up @@ -1457,8 +1458,8 @@ static int spinand_probe(struct platform_device *pdev)

static int spinand_remove(struct platform_device *pdev)
{
struct mtd_info *mtd = platform_get_drvdata(pdev);
struct drv_nand_dev_info *info = mtd->priv;
struct drv_nand_dev_info *info = platform_get_drvdata(pdev);
struct mtd_info *mtd = nand_to_mtd(&info->nand_chip);

platform_set_drvdata(pdev, NULL);

Expand All @@ -1468,16 +1469,14 @@ static int spinand_remove(struct platform_device *pdev)

kfree(info->data_buff);

kfree(mtd);
return E_OK;
}

#ifdef CONFIG_PM
static int spinand_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct mtd_info *mtd = platform_get_drvdata(pdev);
struct drv_nand_dev_info *info = mtd->priv;
struct drv_nand_dev_info *info = platform_get_drvdata(pdev);

if (!IS_ERR(info->clk))
clk_disable(info->clk);
Expand All @@ -1487,8 +1486,7 @@ static int spinand_suspend(struct device *dev)
static int spinand_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct mtd_info *mtd = platform_get_drvdata(pdev);
struct drv_nand_dev_info *info = mtd->priv;
struct drv_nand_dev_info *info = platform_get_drvdata(pdev);

clk_enable(info->clk);

Expand Down