linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 2/4 v2] fbdev: export fb_edid_add_monspecs() for modules,
Date: Thu, 11 Nov 2010 12:58:47 +0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1011111352200.15747@axis700.grange> (raw)
In-Reply-To: <Pine.LNX.4.64.1011021140390.4552@axis700.grange>

On Wed, 10 Nov 2010, Paul Mundt wrote:

> On Tue, Nov 02, 2010 at 11:47:36AM +0100, Guennadi Liakhovetski wrote:
> > diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
> > index a0b5a93..38b3c30 100644
> > --- a/drivers/video/fbmon.c
> > +++ b/drivers/video/fbmon.c
> > @@ -973,58 +973,56 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs)
> >  	DPRINTK("====================\n");
> >  }
> >  
> > +/**
> > + * fb_edid_add_monspecs() - add monitor video modes from E-EDID data
> > + * @edid:	128 byte array with an E-EDID block
> > + * @spacs:	monitor specs to be extended
> > + */
> >  void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
> >  {
> [snip]
> >  	m = kzalloc((specs->modedb_len + num) *
> >  		       sizeof(struct fb_videomode), GFP_KERNEL);
> >  
> > -	if (!m) {
> > -		kfree(mode);
> > +	if (!m)
> >  		return;
> > +
> This can obviously fail, and should be returning the error value instead
> of simply quashing it.

Yes, this can fail, just as well as one of the other tests in the 
beginning of this function:

	if (!edid)
		return;

	if (!edid_checksum(edid))
		return;

	if (edid[0] != 0x2 ||
	    edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE)
		return;

The idea behind the present behaviour is: the function is trying to add 
more modes to the existing modedb, but it can also fail for a number of 
reasons (e.g., no modes found in the new EDID block), in which case you 
just keep your existing modedb. So, in principle, you are not very much 
interested in whether this function managed to add any new modes or not - 
you just use whatever is there. Would you really prefer to change this?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

      parent reply	other threads:[~2010-11-11 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 10:47 [PATCH 2/4 v2] fbdev: export fb_edid_add_monspecs() for modules, Guennadi Liakhovetski
2010-11-10  4:14 ` [PATCH 2/4 v2] fbdev: export fb_edid_add_monspecs() for modules, improve algorithm Paul Mundt
2010-11-10  4:34 ` Paul Mundt
2010-11-11 12:58 ` Guennadi Liakhovetski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1011111352200.15747@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).