* [PATCH 1/2] state: write names in enum32 variables to oftree again
@ 2015-09-23 15:26 Sascha Hauer
2015-09-23 15:26 ` [PATCH 2/2] state: check return value of of_property_count_strings Sascha Hauer
2015-09-24 14:07 ` [PATCH 1/2] state: write names in enum32 variables to oftree again Marc Kleine-Budde
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2015-09-23 15:26 UTC (permalink / raw)
To: Barebox List
Commit 179b75a (state: fixup: only export default value during
fixup if set) accidently removed writing the enum32 value names
to the device tree. Add it back again
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
---
common/state.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/common/state.c b/common/state.c
index aa436fc..9f8ead1 100644
--- a/common/state.c
+++ b/common/state.c
@@ -259,13 +259,6 @@ static int state_enum32_export(struct state_variable *var,
return ret;
}
- if (conv == STATE_CONVERT_FIXUP)
- return 0;
-
- ret = of_property_write_u32(node, "value", enum32->value);
- if (ret)
- return ret;
-
len = 0;
for (i = 0; i < enum32->num_names; i++)
@@ -281,6 +274,13 @@ static int state_enum32_export(struct state_variable *var,
free(prop);
+ if (conv == STATE_CONVERT_FIXUP)
+ return 0;
+
+ ret = of_property_write_u32(node, "value", enum32->value);
+ if (ret)
+ return ret;
+
return ret;
}
--
2.5.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] state: check return value of of_property_count_strings
2015-09-23 15:26 [PATCH 1/2] state: write names in enum32 variables to oftree again Sascha Hauer
@ 2015-09-23 15:26 ` Sascha Hauer
2015-09-24 14:07 ` [PATCH 1/2] state: write names in enum32 variables to oftree again Marc Kleine-Budde
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2015-09-23 15:26 UTC (permalink / raw)
To: Barebox List
When a enum32 state variable node does not have a "names" property bail
out instead of continuing with an error value used as number of strings.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/state.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common/state.c b/common/state.c
index 9f8ead1..117a686 100644
--- a/common/state.c
+++ b/common/state.c
@@ -318,6 +318,10 @@ static struct state_variable *state_enum32_create(struct state *state,
enum32 = xzalloc(sizeof(*enum32));
num_names = of_property_count_strings(node, "names");
+ if (num_names < 0) {
+ dev_err(&state->dev, "enum32 node without \"names\" property\n");
+ return ERR_PTR(-EINVAL);
+ }
enum32->names = xzalloc(sizeof(char *) * num_names);
enum32->num_names = num_names;
--
2.5.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] state: write names in enum32 variables to oftree again
2015-09-23 15:26 [PATCH 1/2] state: write names in enum32 variables to oftree again Sascha Hauer
2015-09-23 15:26 ` [PATCH 2/2] state: check return value of of_property_count_strings Sascha Hauer
@ 2015-09-24 14:07 ` Marc Kleine-Budde
1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2015-09-24 14:07 UTC (permalink / raw)
To: Sascha Hauer, Barebox List
[-- Attachment #1.1: Type: text/plain, Size: 670 bytes --]
On 09/23/2015 05:26 PM, Sascha Hauer wrote:
> Commit 179b75a (state: fixup: only export default value during
> fixup if set) accidently removed writing the enum32 value names
> to the device tree. Add it back again
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-24 14:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23 15:26 [PATCH 1/2] state: write names in enum32 variables to oftree again Sascha Hauer
2015-09-23 15:26 ` [PATCH 2/2] state: check return value of of_property_count_strings Sascha Hauer
2015-09-24 14:07 ` [PATCH 1/2] state: write names in enum32 variables to oftree again Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox