Date:2012-04-09 10:44:01 (8 years 1 month ago)
Author:Lars C.
Commit:3d14a726b6519673b7b025f46f9497020e0cd68f
Message:ili8960: Use devm_kzalloc

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Files: drivers/video/backlight/ili8960.c (5 diffs)

Change Details

drivers/video/backlight/ili8960.c
150150    int ret;
151151    struct ili8960 *ili8960;
152152
153    ili8960 = kmalloc(sizeof(*ili8960), GFP_KERNEL);
153    ili8960 = devm_kzalloc(&spi->dev, sizeof(*ili8960), GFP_KERNEL);
154154    if (!ili8960)
155155        return -ENOMEM;
156156
...... 
160160    ret = spi_setup(spi);
161161    if (ret) {
162162        dev_err(&spi->dev, "Failed to setup spi\n");
163        goto err_free_ili8960;
163        return ret;
164164    }
165165
166166    ili8960->spi = spi;
...... 
171171    if (IS_ERR(ili8960->lcd)) {
172172        ret = PTR_ERR(ili8960->lcd);
173173        dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret);
174        goto err_free_ili8960;
174        return ret;
175175    }
176176
177177    ili8960->lcd->props.max_contrast = 255;
...... 
190190    return 0;
191191err_unregister_lcd:
192192    lcd_device_unregister(ili8960->lcd);
193err_free_ili8960:
194    kfree(ili8960);
195193    return ret;
196194}
197195
...... 
203201    lcd_device_unregister(ili8960->lcd);
204202
205203    spi_set_drvdata(spi, NULL);
206    kfree(ili8960);
207204    return 0;
208205}
209206

Archive Download the corresponding diff file



interactive