lkml.org 
[lkml]   [2019]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH lora-next 01/11] net: lora: sx125x: Abort on wrong version
Date
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(-)

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);
}

--
2.16.4
\
 
 \ /
  Last update: 2019-01-06 09:40    [W:0.046 / U:1.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site