diff options
author | Anca Jeanina FLOAREA <anca.floarea@freescale.com> | 2013-07-08 12:28:12 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-11 22:27:33 (GMT) |
commit | c0a8056e2ddf7c372d8693d8230083cc3421ca0d (patch) | |
tree | dc29692811171d396befed1d35bdf58a3e8fb827 /drivers/staging | |
parent | 3dd8f75d5b40f4141ae03065161b00d45b519cb8 (diff) | |
download | linux-fsl-qoriq-c0a8056e2ddf7c372d8693d8230083cc3421ca0d.tar.xz |
dpa_offload: Fix function free_resources to take in account errors
Function free_resources was not taking in account error codes returned
by free_cnts_resources and free_reqs_resources functions. In case an
error occurred, function should be exited, so that the DPA Stats
structure is not released.
Signed-off-by: Anca Jeanina FLOAREA <anca.floarea@freescale.com>
Change-Id: I74800a38f52634ca1e38e1d68d5637a4480bf525
Reviewed-on: http://git.am.freescale.net:8181/2967
Reviewed-by: Zanoschi Aurelian-B43522 <Aurelian.Zanoschi@freescale.com>
Reviewed-by: Chereji Marian-Cornel-R27762 <marian.chereji@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/fsl_dpa_offload/dpa_stats.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/staging/fsl_dpa_offload/dpa_stats.c b/drivers/staging/fsl_dpa_offload/dpa_stats.c index 6ae4e9e6..b911732 100644 --- a/drivers/staging/fsl_dpa_offload/dpa_stats.c +++ b/drivers/staging/fsl_dpa_offload/dpa_stats.c @@ -619,9 +619,10 @@ static int free_reqs_resources(struct dpa_stats *dpa_stats) } /* cleanup DPA Stats */ -static void free_resources(void) +static int free_resources(void) { struct dpa_stats *dpa_stats; + int err = 0; /* Sanity check */ if (!gbl_dpa_stats) { @@ -631,13 +632,18 @@ static void free_resources(void) dpa_stats = gbl_dpa_stats; /* free resources occupied by counters control blocks */ - free_cnts_resources(dpa_stats); + err = free_cnts_resources(dpa_stats); + if (err < 0) + return err; /* free resources occupied by requests control blocks */ - free_reqs_resources(dpa_stats); + err = free_reqs_resources(dpa_stats); + if (err < 0) + return err; kfree(dpa_stats); gbl_dpa_stats = NULL; + return 0; } static int treat_cnts_request(struct dpa_stats *dpa_stats, @@ -3694,8 +3700,6 @@ int dpa_stats_free(int dpa_stats_id) /* multiple DPA Stats instances are not currently supported */ unused(dpa_stats_id); - free_resources(); - - return 0; + return free_resources(); } EXPORT_SYMBOL(dpa_stats_free); |