diff options
author | Olivier Sobrie <olivier@sobrie.be> | 2012-02-29 02:06:40 -0500 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2012-03-08 13:12:22 -0500 |
commit | e71ff6f265c80b6f04f1d16470b5afa58f0b4648 (patch) | |
tree | 5fc94eeeab06d4aee5f0982096b1dd9420d4f78b /drivers/video/udlfb.c | |
parent | 33ad39121d5527048394003d16b8b38f1140ebf1 (diff) |
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: Olivier Sobrie <olivier@sobrie.be>
Acked-by: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/udlfb.c')
-rw-r--r-- | drivers/video/udlfb.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 86c8b256e306..157df78e5bfc 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c | |||
@@ -1432,19 +1432,22 @@ static ssize_t edid_store( | |||
1432 | struct device *fbdev = container_of(kobj, struct device, kobj); | 1432 | struct device *fbdev = container_of(kobj, struct device, kobj); |
1433 | struct fb_info *fb_info = dev_get_drvdata(fbdev); | 1433 | struct fb_info *fb_info = dev_get_drvdata(fbdev); |
1434 | struct dlfb_data *dev = fb_info->par; | 1434 | struct dlfb_data *dev = fb_info->par; |
1435 | int ret; | ||
1435 | 1436 | ||
1436 | /* We only support write of entire EDID at once, no offset*/ | 1437 | /* We only support write of entire EDID at once, no offset*/ |
1437 | if ((src_size != EDID_LENGTH) || (src_off != 0)) | 1438 | if ((src_size != EDID_LENGTH) || (src_off != 0)) |
1438 | return 0; | 1439 | return -EINVAL; |
1439 | 1440 | ||
1440 | dlfb_setup_modes(dev, fb_info, src, src_size); | 1441 | ret = dlfb_setup_modes(dev, fb_info, src, src_size); |
1442 | if (ret) | ||
1443 | return ret; | ||
1441 | 1444 | ||
1442 | if (dev->edid && (memcmp(src, dev->edid, src_size) == 0)) { | 1445 | if (!dev->edid || memcmp(src, dev->edid, src_size)) |
1443 | pr_info("sysfs written EDID is new default\n"); | 1446 | return -EINVAL; |
1444 | dlfb_ops_set_par(fb_info); | 1447 | |
1445 | return src_size; | 1448 | pr_info("sysfs written EDID is new default\n"); |
1446 | } else | 1449 | dlfb_ops_set_par(fb_info); |
1447 | return 0; | 1450 | return src_size; |
1448 | } | 1451 | } |
1449 | 1452 | ||
1450 | static ssize_t metrics_reset_store(struct device *fbdev, | 1453 | static ssize_t metrics_reset_store(struct device *fbdev, |