samples: drivers: jesd216: check return value of flash_sfdp_read()

Check the return value of flash_sfdp_read() and print error message if
not successful.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit is contained in:
Henrik Brix Andersen 2020-08-23 20:34:50 +02:00 committed by Ioannis Glaropoulos
parent f5d606ef72
commit 8b94d67dc8

View file

@ -241,6 +241,13 @@ void main(void)
} u;
const struct jesd216_sfdp_header *hp = &u.sfdp;
int rc = flash_sfdp_read(dev, 0, u.raw, sizeof(u.raw));
if (rc != 0) {
printf("Read SFDP not supported: device not JESD216-compliant "
"(err %d)\n", rc);
return;
}
uint32_t magic = jesd216_sfdp_magic(hp);
if (magic != JESD216_SFDP_MAGIC) {