summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlokilee73 <changjoo.lee@samsung.com>2017-09-26 04:03:29 +0000
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>2017-09-26 04:03:29 +0000
commitd64d9a73cf0ca580ae76c4d95e359ee98e3c3095 (patch)
tree5a24bb97b170b201ed12d8ad5ebaa309c9898e31
parentfb08937c04cea47e3a0742a1f941763b359bd479 (diff)
parent61abd9ddcd2e00098ec4393ef43a989b8e4f4171 (diff)
downloaddevice-manager-plugin-artik-d64d9a73cf0ca580ae76c4d95e359ee98e3c3095.tar.gz
device-manager-plugin-artik-d64d9a73cf0ca580ae76c4d95e359ee98e3c3095.tar.bz2
device-manager-plugin-artik-d64d9a73cf0ca580ae76c4d95e359ee98e3c3095.zip
Merge "Common: initialize and modify exception for n_configs" into tizen
-rwxr-xr-x[-rw-r--r--]hw/usb_gadget/usb_gadget.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb_gadget/usb_gadget.c b/hw/usb_gadget/usb_gadget.c
index 0bcb10b..32641d0 100644..100755
--- a/hw/usb_gadget/usb_gadget.c
+++ b/hw/usb_gadget/usb_gadget.c
@@ -185,7 +185,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
struct usb_gadget **_gadget)
{
struct usb_gadget *gadget;
- int n_configs;
+ unsigned int n_configs = 0;
/* zero terminates */
int functions[2][sizeof(gadget_id->function_mask)*8];
int n_functions;
@@ -285,7 +285,7 @@ static int simple_id_to_gadget(struct usb_gadget_id *gadget_id,
break;
};
- if (n_configs > 2) {
+ if (n_configs > 2 || n_configs == 0) {
ret = -EINVAL;
goto free_gadget;
}