Skip to content

Commit 3fd3f45

Browse files
povikmarcan
authored andcommitted
gpu: drm: apple: Add 'parse_blob'
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
1 parent 6dd5021 commit 3fd3f45

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/gpu/drm/apple/parser.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,26 @@ static int parse_bool(struct dcp_parse_ctx *handle, bool *b)
199199
return 0;
200200
}
201201

202+
static int parse_blob(struct dcp_parse_ctx *handle, size_t size, u8 **blob)
203+
{
204+
struct dcp_parse_tag *tag = parse_tag_of_type(handle, DCP_TYPE_BLOB);
205+
u8 *out;
206+
207+
if (IS_ERR(tag))
208+
return PTR_ERR(tag);
209+
210+
if (tag->size < size)
211+
return -EINVAL;
212+
213+
out = parse_bytes(handle, tag->size);
214+
215+
if (IS_ERR(out))
216+
return PTR_ERR(out);
217+
218+
*blob = out;
219+
return 0;
220+
}
221+
202222
struct iterator {
203223
struct dcp_parse_ctx *handle;
204224
u32 idx, len;

0 commit comments

Comments
 (0)