[PATCH 2/8] fb: return original fb_info in FBIOGET_SCREENINFO

Sascha Hauer s.hauer at pengutronix.de
Fri Aug 7 06:45:35 PDT 2015


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/video/fb.c      | 4 +++-
 lib/gui/graphic_utils.c | 6 ++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 29b4c71..dbda8d4 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -11,10 +11,12 @@
 static int fb_ioctl(struct cdev* cdev, int req, void *data)
 {
 	struct fb_info *info = cdev->priv;
+	struct fb_info **fb;
 
 	switch (req) {
 	case FBIOGET_SCREENINFO:
-		memcpy(data, info, sizeof(*info));
+		fb = data;
+		*fb = info;
 		break;
 	case FBIO_ENABLE:
 		info->fbops->fb_enable(info);
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index 47003a0..f928ee1 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -281,7 +281,7 @@ struct screen *fb_open(const char * fbdev, bool offscreen)
 
 	info = xzalloc(sizeof(*info));
 
-	ret = ioctl(fd, FBIOGET_SCREENINFO, info);
+	ret = ioctl(fd, FBIOGET_SCREENINFO, &info);
 	if (ret) {
 		goto failed_screeninfo;
 	}
@@ -310,10 +310,8 @@ void fb_close(struct screen *sc)
 {
 	free(sc->offscreenbuf);
 
-	if (sc->fd > 0) {
+	if (sc->fd > 0)
 		close(sc->fd);
-		free(sc->info);
-	}
 
 	free(sc);
 }
-- 
2.4.6




More information about the barebox mailing list