Commit 3c624d49 authored by Roger Quadros's avatar Roger Quadros Committed by Greg Kroah-Hartman

usb: gadget: f_mass_storage: If 'ro'/'cdrom' specified, open file as read-only

If we don't need Write access then attempt to open backing file in Read Only
mode instead of bailing out too soon.
Signed-off-by: default avatarRoger Quadros <roger.quadros@nokia.com>
Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 73ee4da9
......@@ -2757,6 +2757,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
for (i = 0, lcfg = cfg->luns; i < nluns; ++i, ++curlun, ++lcfg) {
curlun->cdrom = !!lcfg->cdrom;
curlun->ro = lcfg->cdrom || lcfg->ro;
curlun->initially_ro = curlun->ro;
curlun->removable = lcfg->removable;
curlun->dev.release = fsg_lun_release;
curlun->dev.parent = &gadget->dev;
......
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