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 02/11] net: lora: sx130x: Fix error codes
Date
Use of -ENXIO results in a misleading error message from ip command:

RTNETLINK answers: No such device or address

Switch to -EIO for more accurate description:

RTNETLINK answers: Input/output error

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
drivers/net/lora/sx130x.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/lora/sx130x.c b/drivers/net/lora/sx130x.c
index 88d4ce1aabcf..21db0ddb101f 100644
--- a/drivers/net/lora/sx130x.c
+++ b/drivers/net/lora/sx130x.c
@@ -353,7 +353,7 @@ static int sx130x_agc_calibrate(struct sx130x_priv *priv)
if (val != SX1301_MCU_AGC_CAL_FW_VERSION) {
dev_err(priv->dev, "unexpected firmware version, expecting %u\n",
SX1301_MCU_AGC_CAL_FW_VERSION);
- return -ENXIO;
+ return -EIO;
}

ret = sx130x_field_write(priv, F_EMERGENCY_FORCE_HOST_CTRL, 0);
@@ -380,7 +380,7 @@ static int sx130x_agc_calibrate(struct sx130x_priv *priv)
dev_info(priv->dev, "AGC status: %02x\n", (unsigned)val);
if ((val & (BIT(7) | BIT(0))) != (BIT(7) | BIT(0))) {
dev_err(priv->dev, "AGC calibration failed\n");
- return -ENXIO;
+ return -EIO;
}

return 0;
@@ -453,7 +453,7 @@ static int sx130x_load_all_firmware(struct sx130x_priv *priv)
if (val != SX1301_MCU_AGC_FW_VERSION) {
dev_err(priv->dev, "unexpected firmware version, expecting %u\n",
SX1301_MCU_AGC_FW_VERSION);
- return -ENXIO;
+ return -EIO;
}

ret = sx130x_arb_ram_read(priv, 0x20, &val);
@@ -467,7 +467,7 @@ static int sx130x_load_all_firmware(struct sx130x_priv *priv)
if (val != SX1301_MCU_ARB_FW_VERSION) {
dev_err(priv->dev, "unexpected firmware version, expecting %u\n",
SX1301_MCU_ARB_FW_VERSION);
- return -ENXIO;
+ return -EIO;
}

return 0;
@@ -636,7 +636,7 @@ int sx130x_probe(struct device *dev)

if (ver != SX1301_CHIP_VERSION) {
dev_err(dev, "unexpected version: %u\n", ver);
- return -ENXIO;
+ return -EIO;
}

ret = regmap_write(priv->regmap, SX1301_PAGE, 0);
--
2.16.4
\
 
 \ /
  Last update: 2019-01-06 09:40    [W:0.096 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site