]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
udlfb: Fix invalid return codes in edid sysfs entry store function
authorOlivier Sobrie <olivier@sobrie.be>
Wed, 29 Feb 2012 07:06:40 +0000 (08:06 +0100)
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Thu, 8 Mar 2012 18:12:22 +0000 (18:12 +0000)
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>
Acked-by: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
drivers/video/udlfb.c

index 86c8b256e306f0d1fbf7224f2ecc1c1d79a58451..157df78e5bfc843a680af83c764b66dfe2f208cf 100644 (file)
@@ -1432,19 +1432,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;
+       if (!dev->edid || memcmp(src, dev->edid, src_size))
+               return -EINVAL;
+
+       pr_info("sysfs written EDID is new default\n");
+       dlfb_ops_set_par(fb_info);
+       return src_size;
 }
 
 static ssize_t metrics_reset_store(struct device *fbdev,