aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-max7301.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpio-max7301.c')
-rw-r--r--drivers/gpio/gpio-max7301.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c
index c6c535c1310e..3b16ab701630 100644
--- a/drivers/gpio/gpio-max7301.c
+++ b/drivers/gpio/gpio-max7301.c
@@ -56,12 +56,13 @@ static int max7301_probe(struct spi_device *spi)
56 int ret; 56 int ret;
57 57
58 /* bits_per_word cannot be configured in platform data */ 58 /* bits_per_word cannot be configured in platform data */
59 spi->bits_per_word = 16; 59 if (spi->dev.platform_data)
60 spi->bits_per_word = 16;
60 ret = spi_setup(spi); 61 ret = spi_setup(spi);
61 if (ret < 0) 62 if (ret < 0)
62 return ret; 63 return ret;
63 64
64 ts = kzalloc(sizeof(struct max7301), GFP_KERNEL); 65 ts = devm_kzalloc(&spi->dev, sizeof(struct max7301), GFP_KERNEL);
65 if (!ts) 66 if (!ts)
66 return -ENOMEM; 67 return -ENOMEM;
67 68
@@ -70,8 +71,6 @@ static int max7301_probe(struct spi_device *spi)
70 ts->dev = &spi->dev; 71 ts->dev = &spi->dev;
71 72
72 ret = __max730x_probe(ts); 73 ret = __max730x_probe(ts);
73 if (ret)
74 kfree(ts);
75 return ret; 74 return ret;
76} 75}
77 76