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

Skip to content
Commit daeec1f0 authored by Tony Prisk's avatar Tony Prisk
Browse files

of: Remove duplicated code for validating property and value



Several functions in of/base.c have the same code duplicated for
finding and validating a property and value.

struct property *prop = of_find_property(np, propname, NULL);
if (!prop)
	return -EINVAL;
if (!prop->value)
	return -ENODATA;
if (<some length> > prop->length)
	return -EOVERFLOW;

This patch adds of_find_property_value_of_size() which performs the
equivalent of the above code and removes the instances where it was
duplicated in several functions.

Reported-by: default avatarRob Herring <robherring2@gmail.com>
Signed-off-by: default avatarTony Prisk <linux@prisktech.co.nz>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarRob Herring <rob.herring@calxeda.com>
parent 3daf3726
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment