Bug in register_framebuffer ??

From: Michael McLagan <hidden>
Date: 2003-11-25 21:20:52

Hello,

   I'm looking into a problem with the ivtv (Hauppauge PVR) frame buffer
driver and I came across this piece of code in fbmem.c, line 782, v2.4.22:
	for (j = 0; j < MAX_NR_CONSOLES; j++)
		if (con2fb_map[j] == i) {
			if (owner)
				__MOD_INC_USE_COUNT(owner);
			if (!fb_info->fbops->fb_open)
				continue;
			if (!fb_info->fbops->fb_open(fb_info,0))
				continue;
			if (owner)
				__MOD_DEC_USE_COUNT(owner);
		}
	fb_ever_opened[i] = 1;
  I believe this is causing us a problem with the module usage count
being incremented despite there being no visible use on the system.  
Since the driver doesn't define fb_open, it looks like the above will
increment the use count without decrementing it.

Should it be coded:

		for (j = 0; j < MAX_NR_CONSOLES; j++)
			if ((con2fb_map[j] == i) && fb_info->fbops->fb_open) {
			    if (owner) {
				__MOD_INC_USE_COUNT(owner);
			        if (!fb_info->fbops->fb_open(fb_info,0))
				    __MOD_DEC_USE_COUNT(owner);
			    } else {
				fb_info->fbops->fb_open(fb_info,0);
			    }
			}
		fb_ever_opened[i] = 1;

Seems to me that does the same thing without artificially inflating
the module usage count.

If that makes sense, could someone either let me know or pass it on 
to Marcelo and Linus (assuming 2.6 uses the same piece of code)?

   Michael




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help