]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/mfd/wm831x-spi.c
mfd: Convert wm831x core driver to devm_kzalloc()
[karo-tx-linux.git] / drivers / mfd / wm831x-spi.c
index 8d6a9a969dbc246e87d46eb8bf38e0b62b796149..a43cba373001a7c7426cf1b0a8e3f0276bc92967 100644 (file)
@@ -30,7 +30,7 @@ static int __devinit wm831x_spi_probe(struct spi_device *spi)
 
        type = (enum wm831x_parent)id->driver_data;
 
-       wm831x = kzalloc(sizeof(struct wm831x), GFP_KERNEL);
+       wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
        if (wm831x == NULL)
                return -ENOMEM;
 
@@ -45,7 +45,6 @@ static int __devinit wm831x_spi_probe(struct spi_device *spi)
                ret = PTR_ERR(wm831x->regmap);
                dev_err(wm831x->dev, "Failed to allocate register map: %d\n",
                        ret);
-               kfree(wm831x);
                return ret;
        }