summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2021-06-09 17:34:55 -0500
committerDavid S. Miller <davem@davemloft.net>2021-06-09 15:59:33 -0700
commit0300df2d9d249c3dd8e0ad1b7dd5b7da1b8d0e37 (patch)
treee8df592dc92be6c6418f0d79fae45bd54a6b07f5 /drivers
parent14ab6a208c11dcb7b91fda3e0866c7e6188dc553 (diff)
downloadlinux-0300df2d9d249c3dd8e0ad1b7dd5b7da1b8d0e37.tar.bz2
net: ipa: validate memory regions unconditionally
Do memory region descriptor validation unconditionally, rather than having it depend on IPA_VALIDATION being defined. Pass the address of a memory region descriptor rather than a memory ID to ipa_mem_valid(). Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ipa/ipa_mem.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c
index e3c43cf6e441..effaa745a406 100644
--- a/drivers/net/ipa/ipa_mem.c
+++ b/drivers/net/ipa/ipa_mem.c
@@ -99,12 +99,10 @@ int ipa_mem_setup(struct ipa *ipa)
return 0;
}
-#ifdef IPA_VALIDATE
-
-static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
+static bool ipa_mem_valid(struct ipa *ipa, const struct ipa_mem *mem)
{
- const struct ipa_mem *mem = &ipa->mem[mem_id];
struct device *dev = &ipa->pdev->dev;
+ enum ipa_mem_id mem_id = mem->id;
u16 size_multiple;
/* Other than modem memory, sizes must be a multiple of 8 */
@@ -128,15 +126,6 @@ static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
return false;
}
-#else /* !IPA_VALIDATE */
-
-static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
-{
- return true;
-}
-
-#endif /*! IPA_VALIDATE */
-
/**
* ipa_mem_config() - Configure IPA shared memory
* @ipa: IPA pointer
@@ -188,7 +177,7 @@ int ipa_mem_config(struct ipa *ipa)
__le32 *canary;
/* Validate all regions (even undefined ones) */
- if (!ipa_mem_valid(ipa, mem_id))
+ if (!ipa_mem_valid(ipa, mem))
goto err_dma_free;
/* Skip over undefined regions */