Commit e71ff6f2 authored by Olivier Sobrie's avatar Olivier Sobrie Committed by Florian Tobias Schandinat

udlfb: Fix invalid return codes in edid sysfs entry store function

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: default avatarOlivier Sobrie <olivier@sobrie.be>
Acked-by: default avatarBernie Thompson <bernie@plugable.com>
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent 33ad3912
...@@ -1432,19 +1432,22 @@ static ssize_t edid_store( ...@@ -1432,19 +1432,22 @@ static ssize_t edid_store(
struct device *fbdev = container_of(kobj, struct device, kobj); struct device *fbdev = container_of(kobj, struct device, kobj);
struct fb_info *fb_info = dev_get_drvdata(fbdev); struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dev = fb_info->par; struct dlfb_data *dev = fb_info->par;
int ret;
/* We only support write of entire EDID at once, no offset*/ /* We only support write of entire EDID at once, no offset*/
if ((src_size != EDID_LENGTH) || (src_off != 0)) 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)) { if (!dev->edid || memcmp(src, dev->edid, src_size))
pr_info("sysfs written EDID is new default\n"); return -EINVAL;
dlfb_ops_set_par(fb_info);
return src_size; pr_info("sysfs written EDID is new default\n");
} else dlfb_ops_set_par(fb_info);
return 0; return src_size;
} }
static ssize_t metrics_reset_store(struct device *fbdev, static ssize_t metrics_reset_store(struct device *fbdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment