[lldp-devel] [PATCH] lldpad: Fix error path in save_dcbx_version

Mark Rustad mark.d.rustad at intel.com
Thu Aug 11 21:09:01 UTC 2011


One error path would not return an error indication to the caller.
Fix that and eliminate the useless rval variable.

Signed-off-by: Mark Rustad <mark.d.rustad at intel.com>
Tested-by: Ross Brattain <ross.b.brattain at intel.com>
---
 lldp_dcbx_cfg.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lldp_dcbx_cfg.c b/lldp_dcbx_cfg.c
index 0477c54..7a447e3 100644
--- a/lldp_dcbx_cfg.c
+++ b/lldp_dcbx_cfg.c
@@ -612,19 +612,17 @@ int save_dcb_enable_state(char *device_name, int dcb_enable)
 
 int save_dcbx_version(int dcbx_version)
 {
-	config_setting_t *dcbx_setting = NULL;
-	config_setting_t *setting = NULL;
-	int rval = dcb_success;
+	config_setting_t *dcbx_setting;
+	config_setting_t *setting;
 
 	dcbx_setting = config_lookup(&lldpad_cfg, DCBX_SETTING);
 	if (!dcbx_setting)
 		return 1;
 
 	setting = config_setting_get_member(dcbx_setting, "dcbx_version");
-
 	if (!setting || !config_setting_set_int(setting, dcbx_version) ||
 		!config_write_file(&lldpad_cfg, cfg_file_name))
-		rval = dcb_failed;
+		return 1;
 
 	return 0;
 }




More information about the lldp-devel mailing list