diff options
Diffstat (limited to 'drivers/auxdisplay/hd44780.c')
-rw-r--r-- | drivers/auxdisplay/hd44780.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c index 0526f0d90a79..cef42656c4b0 100644 --- a/drivers/auxdisplay/hd44780.c +++ b/drivers/auxdisplay/hd44780.c @@ -222,20 +222,17 @@ static int hd44780_probe(struct platform_device *pdev) return -EINVAL; } - hdc = hd44780_common_alloc(); - if (!hdc) - return -ENOMEM; - - lcd = charlcd_alloc(); + lcd = hd44780_common_alloc(); if (!lcd) - goto fail1; + return -ENOMEM; hd = kzalloc(sizeof(*hd), GFP_KERNEL); if (!hd) goto fail2; + hdc = lcd->drvdata; hdc->hd44780 = hd; - lcd->drvdata = hdc; + for (i = 0; i < ifwidth; i++) { hd->pins[base + i] = devm_gpiod_get_index(dev, "data", i, GPIOD_OUT_LOW); @@ -313,9 +310,7 @@ static int hd44780_probe(struct platform_device *pdev) fail3: kfree(hd); fail2: - kfree(lcd); -fail1: - kfree(hdc); + hd44780_common_free(lcd); return ret; } @@ -326,9 +321,7 @@ static void hd44780_remove(struct platform_device *pdev) charlcd_unregister(lcd); kfree(hdc->hd44780); - kfree(lcd->drvdata); - - kfree(lcd); + hd44780_common_free(lcd); } static const struct of_device_id hd44780_of_match[] = { |