diff options
-rw-r--r-- | drivers/spi/spi-fsl-dspi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index ec0ad01..a6df59e 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -399,8 +399,7 @@ static int dspi_setup(struct spi_device *spi) /* Only alloc on first setup */ chip = spi_get_ctldata(spi); if (chip == NULL) { - chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), - GFP_KERNEL); + chip = kcalloc(1, sizeof(struct chip_data), GFP_KERNEL); if (!chip) return -ENOMEM; } @@ -411,6 +410,7 @@ static int dspi_setup(struct spi_device *spi) fmsz = spi->bits_per_word - 1; } else { pr_err("Invalid wordsize\n"); + kfree(chip); return -ENODEV; } |