Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: linux-omap@vger.kernel.org
Cc: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Subject: [PATCH 4/8] dspbridge: Check pointer returned by MEM_Calloc()
Date: Thu, 27 Aug 2009 15:18:57 +0300	[thread overview]
Message-ID: <1251375541-1866-5-git-send-email-andy.shevchenko@gmail.com> (raw)
In-Reply-To: <1251375541-1866-4-git-send-email-andy.shevchenko@gmail.com>

From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

In case of NULL return DSP_EMEMORY status instead of DSP_SOK.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 drivers/dsp/bridge/rmgr/drv.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 691c727..bedc34c 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -1571,17 +1571,18 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest)
 		/* Releasing resources by deleting the registry key  */
 		dwBuffSize = sizeof(struct CFG_HOSTRES);
 		pResources = MEM_Calloc(dwBuffSize, MEM_NONPAGED);
-		if (DSP_FAILED(REG_GetValue(NULL, (char *)driverExt->szString,
-		   CURRENTCONFIG, (u8 *)pResources, &dwBuffSize))) {
-			status = CFG_E_RESOURCENOTAVAIL;
-			GT_0trace(curTrace, GT_1CLASS,
-				 "REG_GetValue Failed \n");
-		} else {
-			GT_0trace(curTrace, GT_1CLASS,
-				 "REG_GetValue Succeeded \n");
-		}
-
 		if (pResources != NULL) {
+			if (DSP_FAILED(REG_GetValue(NULL,
+			    (char *) driverExt->szString,
+			    CURRENTCONFIG, (u8 *) pResources, &dwBuffSize))) {
+				status = CFG_E_RESOURCENOTAVAIL;
+				GT_0trace(curTrace, GT_1CLASS,
+					 "REG_GetValue Failed \n");
+			} else {
+				GT_0trace(curTrace, GT_1CLASS,
+					 "REG_GetValue Succeeded \n");
+			}
+
 			dwBuffSize = sizeof(shm_size);
 			status = REG_GetValue(NULL, CURRENTCONFIG, SHMSIZE,
 				(u8 *)&shm_size, &dwBuffSize);
@@ -1646,6 +1647,8 @@ static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 bRequest)
 				 (u32)dwBuffSize);
 			/*  Set all the other entries to NULL */
 			MEM_Free(pResources);
+		} else {
+			status = DSP_EMEMORY;
 		}
 		GT_0trace(curTrace, GT_ENTER, " <- RequestBridgeResources \n");
 		return status;
-- 
1.5.6.5


  reply	other threads:[~2009-08-27 12:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27 12:18 DSP Bridge bunch of fixes Andy Shevchenko
2009-08-27 12:18 ` [PATCH 1/8] dspbridge: Remove useless check Andy Shevchenko
2009-08-27 12:18   ` [PATCH 2/8] dspbridge: Drop useless memory allocation Andy Shevchenko
2009-08-27 12:18     ` [PATCH 3/8] DSPBRIDGE: Check input value Andy Shevchenko
2009-08-27 12:18       ` Andy Shevchenko [this message]
2009-08-27 12:18         ` [PATCH 5/8] dspbridge: Check pointer before dereferencing it Andy Shevchenko
2009-08-27 12:18           ` [PATCH 6/8] dspbridge: Check status before use return value Andy Shevchenko
2009-08-27 12:19             ` [PATCH 7/8] DSPBRIDGE: Check " Andy Shevchenko
2009-08-27 12:19               ` [PATCH 8/8] dspbridge: Check pointer before usage Andy Shevchenko
2009-08-31 20:47                 ` Guzman Lugo, Fernando
2009-09-01  7:59                   ` [PATCH] " Andy Shevchenko
2009-09-01  8:11                     ` andy.shevchenko
2009-08-31 20:21               ` [PATCH 7/8] DSPBRIDGE: Check return value Guzman Lugo, Fernando
2009-08-31 20:21             ` [PATCH 6/8] dspbridge: Check status before use " Guzman Lugo, Fernando
2009-08-31 20:20           ` [PATCH 5/8] dspbridge: Check pointer before dereferencing it Guzman Lugo, Fernando
2009-08-31 20:19         ` [PATCH 4/8] dspbridge: Check pointer returned by MEM_Calloc() Guzman Lugo, Fernando
2009-08-31 20:14       ` [PATCH 3/8] DSPBRIDGE: Check input value Guzman Lugo, Fernando
2009-08-31 20:49     ` [PATCH 2/8] dspbridge: Drop useless memory allocation Guzman Lugo, Fernando
2009-08-31 20:12   ` [PATCH 1/8] dspbridge: Remove useless check Guzman Lugo, Fernando

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251375541-1866-5-git-send-email-andy.shevchenko@gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=ext-andriy.shevchenko@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox