[dpdk-dev] [PATCH 2/3] net/sfc: use locally stored data for logging

Ferruh Yigit ferruh.yigit at intel.com
Thu May 18 12:59:11 CEST 2017


On 5/17/2017 1:25 PM, Andrew Rybchenko wrote:
> Required to be able to use logging in the secondary process
> where Ethernet device pointer stored in sfc_adapter is invalid.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
> Reviewed-by: Andy Moreton <amoreton at solarflare.com>

<...>

> diff --git a/drivers/net/sfc/sfc_log.h b/drivers/net/sfc/sfc_log.h
> index d0f8921..6c43925 100644
> --- a/drivers/net/sfc/sfc_log.h
> +++ b/drivers/net/sfc/sfc_log.h
> @@ -35,18 +35,16 @@
>  /* Log PMD message, automatically add prefix and \n */
>  #define SFC_LOG(sa, level, ...) \
>  	do {								\
> -		const struct rte_eth_dev *_dev = (sa)->eth_dev;		\
> -		const struct rte_pci_device *_pci_dev =			\
> -			RTE_ETH_DEV_TO_PCI(_dev);			\
> +		const struct sfc_adapter *_sa = (sa);			\

Getting following build error with clang and icc [1]. I guess that is
because "_sa" declared on both sfc_log_init() and in the macro that
function uses (SFC_LOG).

[1]
.../drivers/net/sfc/sfc_filter.c:121:2:
error: variable '_sa' is uninitialized when used within its own
initialization [-Werror,-Wuninitialized]
        sfc_log_init(sa, "failed %d", rc);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../drivers/net/sfc/sfc_log.h:68:12: note: expanded from macro
'sfc_log_init'
        SFC_LOG(_sa, INFO,                              \
        ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../drivers/net/sfc/sfc_log.h:38:36: note: expanded from macro 'SFC_LOG'
        const struct sfc_adapter *_sa = (sa);           \
                                 ~~~    ^~


More information about the dev mailing list