functions with useless return
cover functions with useless return
Fix a couple of cases (there are more) where functions always return 0, by changing them to be void.
Stephen Hemminger (2):
log: rte_openlog_stream should be void
eal: pci probe and adjust_config should be void
lib/librte_eal/common/eal_common_log.c | 3 +-- lib/librte_eal/common/eal_common_options.c | 3 +-- lib/librte_eal/common/eal_common_pci.c | 7 ++----- lib/librte_eal/common/eal_options.h | 2 +- lib/librte_eal/common/include/rte_log.h | 5 +---- lib/librte_eal/common/include/rte_pci.h | 6 +----- lib/librte_eal/linuxapp/eal/eal.c | 6 ++---- 7 files changed, 9 insertions(+), 23 deletions(-)
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1429284934-3261-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org
PATCH 1/2 log: rte_openlog_stream should be void
Function always returned 0 and no one was checking anyway.
--- lib/librte_eal/common/eal_common_log.c | 3 +-- lib/librte_eal/common/include/rte_log.h | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-)
lib/librte_eal/common/eal_common_log.c +1 -2
@@ -158,14 +158,13 @@ rte_log_set_history(int enable) }/* Change the stream that will be used by logging system */ -int +void rte_openlog_stream (FILE *f) {if (f ==NULL ) rte_logs.file = default_log_stream;else rte_logs.file = f; -return 0 ; }/* Set global log level */
lib/librte_eal/common/include/rte_log.h +1 -4
@@ -110,11 +110,8 @@ extern FILE *eal_default_log_stream;* * @param f * Pointer to the stream. -* @return -* - 0 on success. -* - Negative on error. */ -int rte_openlog_stream (FILE *f); +void rte_openlog_stream (FILE *f);/** * Set the global log level.
Signature · 1 line
2.1.4
Re: [PATCH 1/2] log: rte_openlog_stream should be void
Quoted 3 lines · Stephen Hemminger
Function always returned 0 and no one was checking anyway.
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 45 lines
--- lib/librte_eal/common/eal_common_log.c | 3 +-- lib/librte_eal/common/include/rte_log.h | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-)lib/librte_eal/common/eal_common_log.c +1
-2@@ -158,14 +158,13 @@ rte_log_set_history(int enable) }/* Change the stream that will be used by logging system */ -int +void rte_openlog_stream (FILE *f) {if (f ==NULL ) rte_logs.file = default_log_stream;else rte_logs.file = f; -return 0 ; }/* Set global log level */ lib/librte_eal/common/include/rte_log.h +1
-4@@ -110,11 +110,8 @@ extern FILE *eal_default_log_stream;* * @param f * Pointer to the stream. -* @return -* - 0 on success. -* - Negative on error. */ -int rte_openlog_stream (FILE *f); +void rte_openlog_stream (FILE *f);/** * Set the global log level. Signature · 1 line
2.1.4
Re: [PATCH 1/2] log: rte_openlog_stream should be void
Quoted 47 lines · On Tue, 19 May 2015 11:24:03 +0100 Bruce Richardson…
Quoted 3 lines · Stephen Hemminger
Function always returned 0 and no one was checking anyway.
Signed-off-by Stephen Hemminger <[email protected]>Acked-by Bruce Richardson <[email protected]>Quoted 40 lines
--- lib/librte_eal/common/eal_common_log.c | 3 +-- lib/librte_eal/common/include/rte_log.h | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-)lib/librte_eal/common/eal_common_log.c +1
-2@@ -158,14 +158,13 @@ rte_log_set_history(int enable) }/* Change the stream that will be used by logging system */ -int +void rte_openlog_stream (FILE *f) {if (f ==NULL ) rte_logs.file = default_log_stream;else rte_logs.file = f; -return 0 ; }/* Set global log level */ lib/librte_eal/common/include/rte_log.h +1
-4@@ -110,11 +110,8 @@ extern FILE *eal_default_log_stream;* * @param f * Pointer to the stream. -* @return -* - 0 on success. -* - Negative on error. */ -int rte_openlog_stream (FILE *f); +void rte_openlog_stream (FILE *f);
Quoted 5 lines
Quoted 5 lines
lib/librte_eal/common/include/rte_log.h +0
-0/** * Set the global log level. Signature · 1 line
2.1.4
Yes it should be void, but technically this is an ABI change. Please drop the patch.
PATCH 2/2 eal: pci probe and adjust_config should be void
In reply to a message not in the archiveThis functions always returned 0 and therefore should be void.
--- lib/librte_eal/common/eal_common_options.c | 3 +-- lib/librte_eal/common/eal_common_pci.c | 7 ++----- lib/librte_eal/common/eal_options.h | 2 +- lib/librte_eal/common/include/rte_pci.h | 6 +----- lib/librte_eal/linuxapp/eal/eal.c | 6 ++---- 5 files changed, 7 insertions(+), 17 deletions(-)
lib/librte_eal/common/eal_common_options.c +1 -2
@@ -794,7 +794,7 @@ eal_parse_common_option(int opt, const char *optarg,return 0 ; } -int +void eal_adjust_config (struct internal_config *internal_cfg) {int i;
@@ -812,7 +812,6 @@ eal_adjust_config(struct internal_config *internal_cfg)for (i =0 ; i <RTE_MAX_NUMA_NODES ; i++) internal_cfg->memory += internal_cfg->socket_mem[i]; -return 0 ; }int
lib/librte_eal/common/eal_common_pci.c +2 -5
@@ -223,7 +223,7 @@ err_return:* all registered drivers that have a matching entry in its id_table * for discovered devices. */ -int +void rte_eal_pci_probe (void ) {struct rte_pci_device *dev =NULL ;
@@ -252,12 +252,10 @@ rte_eal_pci_probe(void)" cannot be used\n" , dev->addr.domain, dev->addr.bus, dev->addr.devid, dev->addr.function); } - -return 0 ; }/* dump one device */ -static int +static void pci_dump_one_device (FILE *f,struct rte_pci_device *dev) {int i;
@@ -273,7 +271,6 @@ pci_dump_one_device(FILE *f, struct rte_pci_device *dev) dev->mem_resource[i].phys_addr, dev->mem_resource[i].len); } -return 0 ; }/* dump devices on the bus */
lib/librte_eal/common/eal_options.h +1 -1
@@ -89,7 +89,7 @@ extern const struct option eal_long_options[];int eal_parse_common_option (int opt,const char *argv,struct internal_config *conf); -int eal_adjust_config (struct internal_config *internal_cfg); +void eal_adjust_config (struct internal_config *internal_cfg);int eal_check_common_options (struct internal_config *internal_cfg);void eal_common_usage (void );enum rte_proc_type_t eal_proc_type_detect (void );
lib/librte_eal/common/include/rte_pci.h +1 -5
@@ -327,12 +327,8 @@ int rte_eal_pci_scan(void);* Scan the content of the PCI bus, and call the probe() function for * all registered drivers that have a matching entry in its id_table * for discovered devices. -* -* @return -* - 0 on success. -* - Negative on error. */ -int rte_eal_pci_probe (void ); +void rte_eal_pci_probe (void );#ifdef RTE_LIBRTE_EAL_HOTPLUG /**
lib/librte_eal/linuxapp/eal/eal.c +2 -4
@@ -621,8 +621,7 @@ eal_parse_args(int argc, char **argv) } } -if (eal_adjust_config (&internal_config) !=0 ) -return -1 ; +eal_adjust_config (&internal_config);/* sanity checks */ if (eal_check_common_options (&internal_config) !=0 ) {
@@ -842,8 +841,7 @@ rte_eal_init(int argc, char **argv)rte_eal_mp_wait_lcore ();/* Probe & Initialize PCI devices */ -if (rte_eal_pci_probe ()) -rte_panic ("Cannot probe PCI\n" ); +rte_eal_pci_probe ();return fctret; }
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1429284934-3261-3-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org
Re: [PATCH 2/2] eal: pci probe and adjust_config should be void
2015-04-17 08:35, Stephen Hemminger:
Quoted 10 lines
This functions always returned 0 and therefore should be void.
Signed-off-by Stephen Hemminger <[email protected]>--- lib/librte_eal/common/eal_common_options.c | 3 +-- lib/librte_eal/common/eal_common_pci.c | 7 ++----- lib/librte_eal/common/eal_options.h | 2 +- lib/librte_eal/common/include/rte_pci.h | 6 +----- lib/librte_eal/linuxapp/eal/eal.c | 6 ++---- 5 files changed, 7 insertions(+), 17 deletions(-)
Why bsdapp is not changed?
You posted a similar patch few days before which was modifying bsdapp:
http://dpdk.org/dev/patchwork/patch/4306/
Neil Horman
Acked-byQuoted 7 lines · Stephen Hemminger
Fix a couple of cases (there are more) where functions always return 0, by changing them to be void.
Stephen Hemminger (2):
log:rte_openlog_streamshould be void
eal: pci probe andadjust_configshould be void
Quoted 13 lines
lib/librte_eal/common/eal_common_log.c | 3 +-- lib/librte_eal/common/eal_common_options.c | 3 +-- lib/librte_eal/common/eal_common_pci.c | 7 ++----- lib/librte_eal/common/eal_options.h | 2 +- lib/librte_eal/common/include/rte_log.h | 5 +---- lib/librte_eal/common/include/rte_pci.h | 6 +----- lib/librte_eal/linuxapp/eal/eal.c | 6 ++---- 7 files changed, 9 insertions(+), 23 deletions(-)Signature · 1 line
2.1.4
Series