diff mbox series

[lora-next,02/11] net: lora: sx130x: Fix error codes

Message ID 20190106083754.6004-3-afaerber@suse.de
State Not Applicable
Delegated to: David Miller
Headers show
Series net: lora: sx130x: Fixes for enabling regcache | expand

Commit Message

Andreas Färber Jan. 6, 2019, 8:37 a.m. UTC
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 mbox series

Patch

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