[PATCH -next] video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"

From: YueHaibing
Date: Fri Nov 16 2018 - 06:03:13 EST


'info->modes' got allocated with devm_kcalloc in of_get_pxafb_display.

This gives this error message:
./drivers/video/fbdev/pxafb.c:2238:2-7: WARNING: invalid free of devm_ allocated data

Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
---
drivers/video/fbdev/pxafb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index bbed039..d59c8a5 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2234,10 +2234,8 @@ static struct pxafb_mach_info *of_pxafb_of_mach_info(struct device *dev)
if (!info)
return ERR_PTR(-ENOMEM);
ret = of_get_pxafb_mode_info(dev, info);
- if (ret) {
- kfree(info->modes);
+ if (ret)
return ERR_PTR(ret);
- }

/*
* On purpose, neither lccrX registers nor video memory size can be
--
2.7.0