diff options
author | Alex Elder <elder@linaro.org> | 2015-06-13 11:02:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-06-15 16:49:00 -0700 |
commit | fb690ca96f9a7aff8bc8135ce23606e243f4cbae (patch) | |
tree | 57a404e32984edcc4ce3363a530e4022aefabeff /drivers/staging/greybus/manifest.c | |
parent | d29b3d631e572400b45b5f9e48e432493663b0fc (diff) |
greybus: rename HOST_DEV_CPORT_ID_MAX
We limit the number of host-side CPorts to a fixed maximum (which
is less than the 4096 that UniPro allows). This patch imposes a
similar limit on the CPort IDs defined by modules (signaling an
error if one too large is found in a manifest).
It seems reasonable to use the same value for both limits. Change
the name of the constant that defines the host limit and use it for
both. Update cport_id_valid() to enforce the maximum.
(Ultimately we should impose a limit like this; this change is being
made in preparation for supporting multiple connections over a
single CPort.)
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/manifest.c')
-rw-r--r-- | drivers/staging/greybus/manifest.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c index e329f3763176..ad55a73b737b 100644 --- a/drivers/staging/greybus/manifest.c +++ b/drivers/staging/greybus/manifest.c @@ -224,9 +224,12 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle) if (desc_cport->bundle != bundle_id) continue; + cport_id = le16_to_cpu(desc_cport->id); + if (cport_id > CPORT_ID_MAX) + goto cleanup; + /* Found one. Set up its function structure */ protocol_id = desc_cport->protocol_id; - cport_id = le16_to_cpu(desc_cport->id); if (!gb_connection_create(bundle, cport_id, protocol_id)) goto cleanup; |