/* Returns: 0 on success, negative error value on failure.  */
static int eeprom_layout_update_field(struct eeprom_layout *layout, char *field_name, char *new_data)
/* Returns: 0 on success, negative error value on failure.  */
static int eeprom_layout_update_field(struct eeprom_layout *layout, char *field_name, char *new_data)
{
	int i, err;
	struct eeprom_field *fields = layout->fields;
	if (new_data == NULL)
		return 0;
	if (field_name == NULL)
		return -1;
	for (i = 0; i < layout->num_of_fields; i++) {
		if (fields[i].name == RESERVED_FIELDS ||
		    strcmp(fields[i].name, field_name))
			continue;
		err = fields[i].update(&fields[i], new_data);
		if (err)
			printf("Invalid data for field %s\n", field_name);
		return err;
	}
	printf("No such field '%s'\n", field_name);
	return -1;
}