linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function
@ 2012-02-23  7:53 Olivier Sobrie
  2012-02-28 16:14 ` Florian Tobias Schandinat
  2012-02-29  1:33 ` Jingoo Han
  0 siblings, 2 replies; 3+ messages in thread
From: Olivier Sobrie @ 2012-02-23  7:53 UTC (permalink / raw)
  To: linux-fbdev

Return a negative errno instead of zero in the write function of
the sysfs entry in case of error.
Also add a check on the return value of dlfb_setup_modes().

Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
---
 drivers/video/udlfb.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
index a197731..abbc3fe 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -1427,19 +1427,22 @@ static ssize_t edid_store(
 	struct device *fbdev = container_of(kobj, struct device, kobj);
 	struct fb_info *fb_info = dev_get_drvdata(fbdev);
 	struct dlfb_data *dev = fb_info->par;
+	int ret;
 
 	/* We only support write of entire EDID at once, no offset*/
 	if ((src_size != EDID_LENGTH) || (src_off != 0))
-		return 0;
+		return -EINVAL;
 
-	dlfb_setup_modes(dev, fb_info, src, src_size);
+	ret = dlfb_setup_modes(dev, fb_info, src, src_size);
+	if (ret)
+		return ret;
 
 	if (dev->edid && (memcmp(src, dev->edid, src_size) = 0)) {
 		pr_info("sysfs written EDID is new default\n");
 		dlfb_ops_set_par(fb_info);
 		return src_size;
 	} else
-		return 0;
+		return -EINVAL;
 }
 
 static ssize_t metrics_reset_store(struct device *fbdev,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function
  2012-02-23  7:53 [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function Olivier Sobrie
@ 2012-02-28 16:14 ` Florian Tobias Schandinat
  2012-02-29  1:33 ` Jingoo Han
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Tobias Schandinat @ 2012-02-28 16:14 UTC (permalink / raw)
  To: linux-fbdev

[Cc'ing Bernie Thompson, the udlfb maintainer]
@Bernie: Why don't you add an entry for it in MAINTAINERS?

On 02/23/2012 07:53 AM, Olivier Sobrie wrote:
> Return a negative errno instead of zero in the write function of
> the sysfs entry in case of error.
> Also add a check on the return value of dlfb_setup_modes().
> 
> Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
> ---
>  drivers/video/udlfb.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
> index a197731..abbc3fe 100644
> --- a/drivers/video/udlfb.c
> +++ b/drivers/video/udlfb.c
> @@ -1427,19 +1427,22 @@ static ssize_t edid_store(
>  	struct device *fbdev = container_of(kobj, struct device, kobj);
>  	struct fb_info *fb_info = dev_get_drvdata(fbdev);
>  	struct dlfb_data *dev = fb_info->par;
> +	int ret;
>  
>  	/* We only support write of entire EDID at once, no offset*/
>  	if ((src_size != EDID_LENGTH) || (src_off != 0))
> -		return 0;
> +		return -EINVAL;
>  
> -	dlfb_setup_modes(dev, fb_info, src, src_size);
> +	ret = dlfb_setup_modes(dev, fb_info, src, src_size);
> +	if (ret)
> +		return ret;
>  
>  	if (dev->edid && (memcmp(src, dev->edid, src_size) = 0)) {
>  		pr_info("sysfs written EDID is new default\n");
>  		dlfb_ops_set_par(fb_info);
>  		return src_size;
>  	} else
> -		return 0;
> +		return -EINVAL;
>  }
>  
>  static ssize_t metrics_reset_store(struct device *fbdev,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function
  2012-02-23  7:53 [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function Olivier Sobrie
  2012-02-28 16:14 ` Florian Tobias Schandinat
@ 2012-02-29  1:33 ` Jingoo Han
  1 sibling, 0 replies; 3+ messages in thread
From: Jingoo Han @ 2012-02-29  1:33 UTC (permalink / raw)
  To: linux-fbdev


Hi.
> -----Original Message-----
> From: linux-fbdev-owner@vger.kernel.org [mailto:linux-fbdev-owner@vger.kernel.org] On Behalf Of Florian
> Tobias Schandinat
> Sent: Wednesday, February 29, 2012 1:14 AM
> To: Olivier Sobrie
> Cc: linux-fbdev@vger.kernel.org; Bernie Thompson
> Subject: Re: [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function
> 
> [Cc'ing Bernie Thompson, the udlfb maintainer]
> @Bernie: Why don't you add an entry for it in MAINTAINERS?

I think so, too. :)
Bernie, it would be good to add you to MAINTAINERS as udlfb maintainer.

> 
> On 02/23/2012 07:53 AM, Olivier Sobrie wrote:
> > Return a negative errno instead of zero in the write function of
> > the sysfs entry in case of error.
> > Also add a check on the return value of dlfb_setup_modes().
> >
> > Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
> > ---
> >  drivers/video/udlfb.c |    9 ++++++---
> >  1 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
> > index a197731..abbc3fe 100644
> > --- a/drivers/video/udlfb.c
> > +++ b/drivers/video/udlfb.c
> > @@ -1427,19 +1427,22 @@ static ssize_t edid_store(
> >  	struct device *fbdev = container_of(kobj, struct device, kobj);
> >  	struct fb_info *fb_info = dev_get_drvdata(fbdev);
> >  	struct dlfb_data *dev = fb_info->par;
> > +	int ret;
> >
> >  	/* We only support write of entire EDID at once, no offset*/
> >  	if ((src_size != EDID_LENGTH) || (src_off != 0))
> > -		return 0;
> > +		return -EINVAL;
> >
> > -	dlfb_setup_modes(dev, fb_info, src, src_size);
> > +	ret = dlfb_setup_modes(dev, fb_info, src, src_size);
> > +	if (ret)
> > +		return ret;
> >
> >  	if (dev->edid && (memcmp(src, dev->edid, src_size) = 0)) {
> >  		pr_info("sysfs written EDID is new default\n");
> >  		dlfb_ops_set_par(fb_info);
> >  		return src_size;
> >  	} else
> > -		return 0;
> > +		return -EINVAL;
How about this? According to the coding style, it is more desirable to use braces.
Sorry for nitpicking. :)
 -  	} else
 -		return 0;
 +  	} else {
 +		return -EINVAL;
 +	}
> >  }
> >
> >  static ssize_t metrics_reset_store(struct device *fbdev,
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-29  1:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23  7:53 [PATCH] udlfb: Fix invalid return codes in edid sysfs entry store function Olivier Sobrie
2012-02-28 16:14 ` Florian Tobias Schandinat
2012-02-29  1:33 ` Jingoo Han

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).