Commit 0300df2d authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 14ab6a20
...@@ -99,12 +99,10 @@ int ipa_mem_setup(struct ipa *ipa) ...@@ -99,12 +99,10 @@ int ipa_mem_setup(struct ipa *ipa)
return 0; return 0;
} }
#ifdef IPA_VALIDATE static bool ipa_mem_valid(struct ipa *ipa, const struct ipa_mem *mem)
static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
{ {
const struct ipa_mem *mem = &ipa->mem[mem_id];
struct device *dev = &ipa->pdev->dev; struct device *dev = &ipa->pdev->dev;
enum ipa_mem_id mem_id = mem->id;
u16 size_multiple; u16 size_multiple;
/* Other than modem memory, sizes must be a multiple of 8 */ /* 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) ...@@ -128,15 +126,6 @@ static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
return false; 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_mem_config() - Configure IPA shared memory
* @ipa: IPA pointer * @ipa: IPA pointer
...@@ -188,7 +177,7 @@ int ipa_mem_config(struct ipa *ipa) ...@@ -188,7 +177,7 @@ int ipa_mem_config(struct ipa *ipa)
__le32 *canary; __le32 *canary;
/* Validate all regions (even undefined ones) */ /* Validate all regions (even undefined ones) */
if (!ipa_mem_valid(ipa, mem_id)) if (!ipa_mem_valid(ipa, mem))
goto err_dma_free; goto err_dma_free;
/* Skip over undefined regions */ /* Skip over undefined regions */
......
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