Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31bd8e1e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: android: Add check before calling function's unbind_config()"

parents 7c5344fd af068e4b
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ static const char longname[] = "Gadget Android";
struct android_usb_function {
	char *name;
	void *config;
	/* set only when function's bind_config() is called. */
	bool bound;

	struct device *dev;
	char *dev_name;
@@ -2912,14 +2914,17 @@ android_bind_enabled_functions(struct android_dev *dev,

				f = list_first_entry(&c->functions,
					struct usb_function, list);
				if (f->config) {
					list_del(&f->list);
					if (f->unbind)
						f->unbind(c, f);
				}
			}
			if (c->unbind)
				c->unbind(c);
			return ret;
		}
		f_holder->f->bound = true;
	}
	return 0;
}
@@ -2933,8 +2938,9 @@ android_unbind_enabled_functions(struct android_dev *dev,
		container_of(c, struct android_configuration, usb_config);

	list_for_each_entry(f_holder, &conf->enabled_functions, enabled_list) {
		if (f_holder->f->unbind_config)
		if (f_holder->f->bound && f_holder->f->unbind_config)
			f_holder->f->unbind_config(f_holder->f, c);
		f_holder->f->bound = false;
	}
}
static inline void check_streaming_func(struct usb_gadget *gadget,