Skip to contentSkip to conversation

staging: wfx: simplify virt_addr_valid call

PATCH In review [email protected] 3 participants 3 messages Sep 12, 2020 – Sep 16, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wfx: simplify virt_addr_valid call

From: Tom Rix <[email protected]>

Reviewing sram_write_dma_safe(), there are two identical calls to virt_addr_valid(). The second call can be simplified by a comparison of variables set from the first call.

---
 drivers/staging/wfx/fwio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/fwio.c +1 -1
index 22d3b684f04f..c99adb0c99f1 100644
@@ -94,7 +94,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
 		tmp = buf;
 	}
 	ret = sram_buf_write(wdev, addr, tmp, len);
-	if (!virt_addr_valid(buf))
+	if (tmp != buf)
 		kfree(tmp);
 	return ret;
 }
Signature · 1 line
2.18.1
maintainer
#1 lore raw
Quoted 17 lines · On Sat, Sep 12, 2020 at 07:47:19AM -0700, [email protected] wrote:

From: Tom Rix <[email protected]>

Reviewing sram_write_dma_safe(), there are two identical calls to virt_addr_valid(). The second call can be simplified by a comparison of variables set from the first call.

---
 drivers/staging/wfx/fwio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/fwio.c +0 -0
index 22d3b684f04f..c99adb0c99f1 100644

drivers/staging/wfx/fwio.c static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, · line 100

Quoted 8 lines
drivers/staging/wfx/fwio.c +1 -1
@@ -94,7 +94,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
 		tmp = buf;
 	}
 	ret = sram_buf_write(wdev, addr, tmp, len);
-	if (!virt_addr_valid(buf))
+	if (tmp != buf)
 		kfree(tmp);
 	return ret;
 }

Jerome, any thoughts?

thanks,

greg k-h

Reviewed-by
#2 lore raw
Quoted 13 lines · On Wednesday 16 September 2020 13:11:59 CEST Greg KH wrote:
Quoted 12 lines · On Sat, Sep 12, 2020 at 07:47:19AM -0700, [email protected] wrote:

From: Tom Rix <[email protected]>

Reviewing sram_write_dma_safe(), there are two identical calls to virt_addr_valid(). The second call can be simplified by a comparison of variables set from the first call.

---
 drivers/staging/wfx/fwio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/staging/wfx/fwio.c static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, · line 100

Quoted 13 lines
drivers/staging/wfx/fwio.c +1 -1
index 22d3b684f04f..c99adb0c99f1 100644
@@ -94,7 +94,7 @@ static int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf,
              tmp = buf;
      }
      ret = sram_buf_write(wdev, addr, tmp, len);
-     if (!virt_addr_valid(buf))
+     if (tmp != buf)
              kfree(tmp);
      return ret;
 }

Jerome, any thoughts?

Looks correct.

Signature · 1 line
Jérôme Pouiller