Message ID | 20190106083754.6004-2-afaerber@suse.de |
---|---|
State | New |
Headers | show |
Series | [lora-next,01/11] net: lora: sx125x: Abort on wrong version | expand |
diff --git a/drivers/net/lora/sx125x.c b/drivers/net/lora/sx125x.c index 90e7cdb9d1a8..0228d1f887a0 100644 --- a/drivers/net/lora/sx125x.c +++ b/drivers/net/lora/sx125x.c @@ -195,9 +195,13 @@ static int __maybe_unused sx125x_regmap_probe(struct device *dev, struct regmap if (true) { ret = regmap_read(priv->regmap, SX1255_VERSION, &val); if (ret) { - dev_err(dev, "version read failed\n"); + dev_err(dev, "version read failed (%d)\n", ret); return ret; } + if (val != 0x21) { + dev_err(dev, "unexpected version: %u\n", val); + return -EINVAL; + } dev_info(dev, "SX125x version: %02x\n", val); }
This helps detect issues such as the concentrator being in reset. Enhance error output while at it. Signed-off-by: Andreas Färber <afaerber@suse.de> --- drivers/net/lora/sx125x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.16.4