TLV parsing happens in the TLV drivers probe function (tlv_probe_from_magic()) but register_device() does not propagate errors from match(), always returning zero.
match() however ensures that dev->driver is always NULL if an error occurred on probe and since we're only probing the TLV driver, rely on that as indicator of an error during TLV parsing (e.g. CRC mismatch). Reviewed-by: Ahmad Fatoum <[email protected]> Signed-off-by: Jonas Rebmann <[email protected]> --- commands/tlv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/tlv.c b/commands/tlv.c index 6118a2947f..c01a7b0399 100644 --- a/commands/tlv.c +++ b/commands/tlv.c @@ -29,7 +29,7 @@ static int do_tlv(int argc, char *argv[]) return COMMAND_ERROR_USAGE; tlvdev = tlv_register_device_by_path(filename, NULL); - if (IS_ERR(tlvdev)) { + if (IS_ERR(tlvdev) || tlvdev->dev.driver == NULL) { printf("Could not open \"%s\": %m\n", filename); return COMMAND_ERROR; } -- 2.51.2.535.g419c72cb8a
