BigW Consortium Gitlab

Commit 379eee2f by David Frey

mt7697q: Centralize repeated error messages

parent 22f5b0fc
...@@ -53,24 +53,20 @@ cleanup: ...@@ -53,24 +53,20 @@ cleanup:
static int mt7697io_write32(struct mt7697q_info *qinfo, u8 reg, u32 value) static int mt7697io_write32(struct mt7697q_info *qinfo, u8 reg, u32 value)
{ {
int ret; int ret;
WARN_ON(reg % sizeof(u32)); WARN_ON(reg % sizeof(u32));
ret = mt7697io_write16(qinfo, reg, BF_GET(value, 0, 16)); ret = mt7697io_write16(qinfo, reg, BF_GET(value, 0, 16));
if (ret < 0) { if (ret < 0)
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", goto fail;
__func__, ret);
goto cleanup;
}
ret = mt7697io_write16(qinfo, reg + 2, BF_GET(value, 16, 16)); ret = mt7697io_write16(qinfo, reg + 2, BF_GET(value, 16, 16));
if (ret < 0) { if (ret < 0)
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", goto fail;
__func__, ret);
goto cleanup;
}
cleanup: return ret;
fail:
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", __func__,
ret);
return ret; return ret;
} }
...@@ -102,26 +98,22 @@ static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value) ...@@ -102,26 +98,22 @@ static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value)
int ret; int ret;
u16 low; u16 low;
u16 high; u16 high;
WARN_ON(reg % sizeof(u32)); WARN_ON(reg % sizeof(u32));
ret = mt7697io_read16(qinfo, reg, &low);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n",
__func__, ret);
goto cleanup;
}
ret = mt7697io_read16(qinfo, reg, &low);
if (ret < 0)
goto fail;
ret = mt7697io_read16(qinfo, reg + sizeof(u16), &high); ret = mt7697io_read16(qinfo, reg + sizeof(u16), &high);
if (ret < 0) { if (ret < 0)
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n", goto fail;
__func__, ret);
goto cleanup;
}
*value = (low | (high << 16)); *value = (low | (high << 16));
cleanup: return ret;
return ret;
fail:
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n", __func__,
ret);
return ret;
} }
static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo, bool *slave_busy) static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo, bool *slave_busy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment