diff options
| author | Ghanim Fodi <gfodi@codeaurora.org> | 2016-08-17 18:56:16 +0300 |
|---|---|---|
| committer | Ghanim Fodi <gfodi@codeaurora.org> | 2016-08-23 12:06:27 +0300 |
| commit | e4bbac8c09a4e5c21b74c339b3e8bed79c6bdd7d (patch) | |
| tree | ccef2b5614bbea99efdb81452172b8c808bf8900 | |
| parent | c6b90ab59c5c789c736119e0b4b2332d740684d1 (diff) | |
msm: ipa: fix a static analysis issue at IPA unit-tests
Fix a static analysis issue at IPA driver,
IPA unit-tests I/S. Do not dereference a pointer even
if it can potentially be NULL.
CRs-Fixed: 1055710
Change-Id: Ie7eff49f136fe429ef10c6067ce7d8aae2694d3a
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>
| -rw-r--r-- | drivers/platform/msm/ipa/test/ipa_ut_framework.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/platform/msm/ipa/test/ipa_ut_framework.c b/drivers/platform/msm/ipa/test/ipa_ut_framework.c index b3e0fcfe44f6..3bf9ac11f2d1 100644 --- a/drivers/platform/msm/ipa/test/ipa_ut_framework.c +++ b/drivers/platform/msm/ipa/test/ipa_ut_framework.c @@ -498,10 +498,16 @@ static ssize_t ipa_ut_dbgfs_test_write(struct file *file, goto free_mem; } + suite = test->suite; + if (!suite || !suite->meta_data) { + IPA_UT_ERR("test %s with invalid suite\n", test->name); + rc = -EINVAL; + goto free_mem; + } + IPA_ACTIVE_CLIENTS_INC_SPECIAL("IPA_UT"); - suite = test->suite; - if (suite && suite->meta_data->setup) { + if (suite->meta_data->setup) { IPA_UT_DBG("*** Suite '%s': Run setup ***\n", suite->meta_data->name); rc = suite->meta_data->setup(&suite->meta_data->priv); @@ -530,7 +536,7 @@ static ssize_t ipa_ut_dbgfs_test_write(struct file *file, pr_info("<<<<<<<<<<<=================\n"); } - if (suite && suite->meta_data->teardown) { + if (suite->meta_data->teardown) { IPA_UT_DBG("*** Suite '%s': Run Teardown ***\n", suite->meta_data->name); rc = suite->meta_data->teardown(suite->meta_data->priv); |
