From: Alex Elder Date: Fri, 3 Jun 2016 20:55:30 +0000 (-0500) Subject: greybus: define BUNDLE_ID_NONE X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~291 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=76639ef579012a1276043ed765a14170997155b2;p=karo-tx-linux.git greybus: define BUNDLE_ID_NONE Define a bundle ID that means "no bundle". This will be used for tracing connection events during the portion of a connection's lifetime when it has no bundle associated with it. Don't allow any bundle to be created using that ID. Signed-off-by: Alex Elder Reviewed-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 1810b62457bc..e7c00b679636 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -102,6 +102,11 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id, { struct gb_bundle *bundle; + if (bundle_id == BUNDLE_ID_NONE) { + dev_err(&intf->dev, "can't use bundle id %u\n", bundle_id); + return NULL; + } + /* * Reject any attempt to reuse a bundle id. We initialize * these serially, so there's no need to worry about keeping diff --git a/drivers/staging/greybus/bundle.h b/drivers/staging/greybus/bundle.h index 2dc61ab7495d..3895f94f43c4 100644 --- a/drivers/staging/greybus/bundle.h +++ b/drivers/staging/greybus/bundle.h @@ -12,6 +12,8 @@ #include +#define BUNDLE_ID_NONE U8_MAX + /* Greybus "public" definitions" */ struct gb_bundle { struct device dev;