aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpio-max7301.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c
index c6c535c1310e..6e1c984a75d4 100644
--- a/drivers/gpio/gpio-max7301.c
+++ b/drivers/gpio/gpio-max7301.c
@@ -61,7 +61,7 @@ static int max7301_probe(struct spi_device *spi)
61 if (ret < 0) 61 if (ret < 0)
62 return ret; 62 return ret;
63 63
64 ts = kzalloc(sizeof(struct max7301), GFP_KERNEL); 64 ts = devm_kzalloc(&spi->dev, sizeof(struct max7301), GFP_KERNEL);
65 if (!ts) 65 if (!ts)
66 return -ENOMEM; 66 return -ENOMEM;
67 67
@@ -70,8 +70,6 @@ static int max7301_probe(struct spi_device *spi)
70 ts->dev = &spi->dev; 70 ts->dev = &spi->dev;
71 71
72 ret = __max730x_probe(ts); 72 ret = __max730x_probe(ts);
73 if (ret)
74 kfree(ts);
75 return ret; 73 return ret;
76} 74}
77 75