mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
greybus: bundle: check for duplicate bundle ids
Check at bundle creation time to ensure we're not creating a bundle with an id that's the same as one that's already been created. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
c27a253fc0
commit
8267616b3e
1 changed files with 10 additions and 0 deletions
|
@ -165,6 +165,16 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reject any attempt to reuse a bundle id. We initialize
|
||||||
|
* these serially, so there's no need to worry about keeping
|
||||||
|
* the interface bundle list locked here.
|
||||||
|
*/
|
||||||
|
if (gb_bundle_find(intf, bundle_id)) {
|
||||||
|
pr_err("duplicate bundle id 0x%02hhx\n", bundle_id);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);
|
bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);
|
||||||
if (!bundle)
|
if (!bundle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue