aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-fsl-dspi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 7f0dddb21833..c5ecfc1240ab 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -342,7 +342,8 @@ static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
342 /* Only alloc on first setup */ 342 /* Only alloc on first setup */
343 chip = spi_get_ctldata(spi); 343 chip = spi_get_ctldata(spi);
344 if (chip == NULL) { 344 if (chip == NULL) {
345 chip = kcalloc(1, sizeof(struct chip_data), GFP_KERNEL); 345 chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data),
346 GFP_KERNEL);
346 if (!chip) 347 if (!chip)
347 return -ENOMEM; 348 return -ENOMEM;
348 } 349 }
@@ -353,7 +354,6 @@ static int dspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
353 fmsz = spi->bits_per_word - 1; 354 fmsz = spi->bits_per_word - 1;
354 } else { 355 } else {
355 pr_err("Invalid wordsize\n"); 356 pr_err("Invalid wordsize\n");
356 kfree(chip);
357 return -ENODEV; 357 return -ENODEV;
358 } 358 }
359 359