summaryrefslogtreecommitdiffstats
path: root/common/state/backend_format_raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/state/backend_format_raw.c')
-rw-r--r--common/state/backend_format_raw.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/common/state/backend_format_raw.c b/common/state/backend_format_raw.c
index ea962606cc..105f7dd444 100644
--- a/common/state/backend_format_raw.c
+++ b/common/state/backend_format_raw.c
@@ -16,14 +16,12 @@
*/
#include <common.h>
-#include <common.h>
#include <crypto/keystore.h>
#include <digest.h>
#include <linux/kernel.h>
#include <malloc.h>
#include <crc.h>
#include <of.h>
-#include <crc.h>
#include "state.h"
@@ -34,7 +32,7 @@ struct state_backend_format_raw {
unsigned int digest_length;
/* For outputs */
- struct device_d *dev;
+ struct device *dev;
char *secret_name;
int needs_secret;
@@ -115,11 +113,10 @@ static int backend_format_raw_verify(struct state_backend_format *format,
header = (struct backend_raw_header *)buf;
crc = crc32(0, header, sizeof(*header) - sizeof(uint32_t));
- if (crc != header->header_crc) {
- dev_err(backend_raw->dev, "Error, invalid header crc in raw format, calculated 0x%08x, found 0x%08x\n",
+ if (crc != header->header_crc)
+ return dev_err_state_init(backend_raw->dev, header->header_crc ? -EINVAL : -ENOMEDIUM,
+ "header crc in raw format, calculated 0x%08x, found 0x%08x\n",
crc, header->header_crc);
- return -EINVAL;
- }
if (magic && magic != header->magic) {
dev_err(backend_raw->dev, "Error, invalid magic in raw format 0x%08x, should be 0x%08x\n",
@@ -302,7 +299,7 @@ static int backend_format_raw_init_digest(struct state_backend_format_raw *raw,
int backend_format_raw_create(struct state_backend_format **format,
struct device_node *node, const char *secret_name,
- struct device_d *dev)
+ struct device *dev)
{
struct state_backend_format_raw *raw;
int ret;