mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-24 18:41:00 +00:00
swconfig: remove useless variables, return -1 on errors
spotted with cppcheck Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr> SVN-Revision: 39170
This commit is contained in:
parent
834204bda6
commit
d1156bca0a
@ -178,7 +178,6 @@ swconfig_load_uci(struct switch_dev *dev, const char *name)
|
|||||||
{
|
{
|
||||||
struct uci_context *ctx;
|
struct uci_context *ctx;
|
||||||
struct uci_package *p = NULL;
|
struct uci_package *p = NULL;
|
||||||
struct uci_element *e;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
ctx = uci_alloc_context();
|
ctx = uci_alloc_context();
|
||||||
@ -206,7 +205,6 @@ int main(int argc, char **argv)
|
|||||||
struct switch_dev *dev;
|
struct switch_dev *dev;
|
||||||
struct switch_attr *a;
|
struct switch_attr *a;
|
||||||
struct switch_val val;
|
struct switch_val val;
|
||||||
int err;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int cmd = CMD_NONE;
|
int cmd = CMD_NONE;
|
||||||
@ -289,6 +287,7 @@ int main(int argc, char **argv)
|
|||||||
if(!a)
|
if(!a)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unknown attribute \"%s\"\n", ckey);
|
fprintf(stderr, "Unknown attribute \"%s\"\n", ckey);
|
||||||
|
retval = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,5 +350,5 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
swlib_free_all(dev);
|
swlib_free_all(dev);
|
||||||
return 0;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,6 @@ store_val(struct nl_msg *msg, void *arg)
|
|||||||
{
|
{
|
||||||
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
|
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||||
struct switch_val *val = arg;
|
struct switch_val *val = arg;
|
||||||
struct switch_attr *attr = val->attr;
|
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
goto error;
|
goto error;
|
||||||
@ -669,11 +668,7 @@ done:
|
|||||||
static int
|
static int
|
||||||
list_switch(struct nl_msg *msg, void *arg)
|
list_switch(struct nl_msg *msg, void *arg)
|
||||||
{
|
{
|
||||||
struct swlib_scan_arg *sa = arg;
|
|
||||||
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
|
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||||
struct switch_dev *dev;
|
|
||||||
const char *name;
|
|
||||||
const char *alias;
|
|
||||||
|
|
||||||
if (nla_parse(tb, SWITCH_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0)
|
if (nla_parse(tb, SWITCH_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
@ -729,7 +724,6 @@ struct switch_dev *
|
|||||||
swlib_connect(const char *name)
|
swlib_connect(const char *name)
|
||||||
{
|
{
|
||||||
struct swlib_scan_arg arg;
|
struct swlib_scan_arg arg;
|
||||||
int err;
|
|
||||||
|
|
||||||
if (!refcount) {
|
if (!refcount) {
|
||||||
if (swlib_priv_init() < 0)
|
if (swlib_priv_init() < 0)
|
||||||
|
@ -66,7 +66,6 @@ swlib_map_settings(struct switch_dev *dev, int type, int port_vlan, struct uci_s
|
|||||||
struct switch_attr *attr;
|
struct switch_attr *attr;
|
||||||
struct uci_element *e;
|
struct uci_element *e;
|
||||||
struct uci_option *o;
|
struct uci_option *o;
|
||||||
int i;
|
|
||||||
|
|
||||||
uci_foreach_element(&s->options, e) {
|
uci_foreach_element(&s->options, e) {
|
||||||
o = uci_to_option(e);
|
o = uci_to_option(e);
|
||||||
@ -109,7 +108,6 @@ skip:
|
|||||||
int swlib_apply_from_uci(struct switch_dev *dev, struct uci_package *p)
|
int swlib_apply_from_uci(struct switch_dev *dev, struct uci_package *p)
|
||||||
{
|
{
|
||||||
struct switch_attr *attr;
|
struct switch_attr *attr;
|
||||||
struct uci_context *ctx = p->ctx;
|
|
||||||
struct uci_element *e;
|
struct uci_element *e;
|
||||||
struct uci_section *s;
|
struct uci_section *s;
|
||||||
struct uci_option *o;
|
struct uci_option *o;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user