diff options
Diffstat (limited to 'drivers/usb/gadget/function/f_rndis.c')
-rw-r--r-- | drivers/usb/gadget/function/f_rndis.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index e1d5853ef1e4..c7c5b3ce1d98 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c | |||
@@ -908,6 +908,7 @@ static void rndis_free_inst(struct usb_function_instance *f) | |||
908 | free_netdev(opts->net); | 908 | free_netdev(opts->net); |
909 | } | 909 | } |
910 | 910 | ||
911 | kfree(opts->rndis_interf_group); /* single VLA chunk */ | ||
911 | kfree(opts); | 912 | kfree(opts); |
912 | } | 913 | } |
913 | 914 | ||
@@ -916,6 +917,7 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
916 | struct f_rndis_opts *opts; | 917 | struct f_rndis_opts *opts; |
917 | struct usb_os_desc *descs[1]; | 918 | struct usb_os_desc *descs[1]; |
918 | char *names[1]; | 919 | char *names[1]; |
920 | struct config_group *rndis_interf_group; | ||
919 | 921 | ||
920 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); | 922 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); |
921 | if (!opts) | 923 | if (!opts) |
@@ -940,8 +942,14 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
940 | names[0] = "rndis"; | 942 | names[0] = "rndis"; |
941 | config_group_init_type_name(&opts->func_inst.group, "", | 943 | config_group_init_type_name(&opts->func_inst.group, "", |
942 | &rndis_func_type); | 944 | &rndis_func_type); |
943 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, | 945 | rndis_interf_group = |
944 | names, THIS_MODULE); | 946 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, |
947 | names, THIS_MODULE); | ||
948 | if (IS_ERR(rndis_interf_group)) { | ||
949 | rndis_free_inst(&opts->func_inst); | ||
950 | return ERR_CAST(rndis_interf_group); | ||
951 | } | ||
952 | opts->rndis_interf_group = rndis_interf_group; | ||
945 | 953 | ||
946 | return &opts->func_inst; | 954 | return &opts->func_inst; |
947 | } | 955 | } |