Message ID | 20161019132639.16524-6-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 2016-10-19 06:26 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > command is immediately set to point to a command line literal string > so no need to initialize it to NULL. > > Cleans up 2 cppcheck style warnings: > src/opal/prd_info.c:79: (style) Variable 'command' is reassigned a > value before the old one has been used. > src/opal/prd_info.c:130: (style) Variable 'command' is reassigned a > value before the old one has been used. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/opal/prd_info.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/opal/prd_info.c b/src/opal/prd_info.c > index f507baa..a019b8e 100644 > --- a/src/opal/prd_info.c > +++ b/src/opal/prd_info.c > @@ -73,7 +73,7 @@ int prd_dev_query(fwts_framework *fw) > static int prd_service_check(fwts_framework *fw, int *restart) > { > int rc = FWTS_OK, status = 0, stop_status = 0; > - char *command = NULL; > + char *command; > char *output = NULL; > > command = "systemctl status opal-prd.service 2>&1"; > @@ -124,7 +124,7 @@ out: > static int prd_restart(fwts_framework *fw) > { > int status = 0; > - char *command = NULL; > + char *command; > char *output = NULL; > > command = "systemctl start opal-prd.service 2>&1"; > Acked-by: Alex Hung <alex.hung@canonical.com>
On 2016年10月19日 21:26, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > command is immediately set to point to a command line literal string > so no need to initialize it to NULL. > > Cleans up 2 cppcheck style warnings: > src/opal/prd_info.c:79: (style) Variable 'command' is reassigned a > value before the old one has been used. > src/opal/prd_info.c:130: (style) Variable 'command' is reassigned a > value before the old one has been used. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/opal/prd_info.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/opal/prd_info.c b/src/opal/prd_info.c > index f507baa..a019b8e 100644 > --- a/src/opal/prd_info.c > +++ b/src/opal/prd_info.c > @@ -73,7 +73,7 @@ int prd_dev_query(fwts_framework *fw) > static int prd_service_check(fwts_framework *fw, int *restart) > { > int rc = FWTS_OK, status = 0, stop_status = 0; > - char *command = NULL; > + char *command; > char *output = NULL; > > command = "systemctl status opal-prd.service 2>&1"; > @@ -124,7 +124,7 @@ out: > static int prd_restart(fwts_framework *fw) > { > int status = 0; > - char *command = NULL; > + char *command; > char *output = NULL; > > command = "systemctl start opal-prd.service 2>&1"; > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/opal/prd_info.c b/src/opal/prd_info.c index f507baa..a019b8e 100644 --- a/src/opal/prd_info.c +++ b/src/opal/prd_info.c @@ -73,7 +73,7 @@ int prd_dev_query(fwts_framework *fw) static int prd_service_check(fwts_framework *fw, int *restart) { int rc = FWTS_OK, status = 0, stop_status = 0; - char *command = NULL; + char *command; char *output = NULL; command = "systemctl status opal-prd.service 2>&1"; @@ -124,7 +124,7 @@ out: static int prd_restart(fwts_framework *fw) { int status = 0; - char *command = NULL; + char *command; char *output = NULL; command = "systemctl start opal-prd.service 2>&1";