[PATCH 4/7] drivers: net: fsl-mc: remove the initialisation of global variables

Ramon Fried rfried.dev at gmail.com
Tue Jan 10 18:07:45 CET 2023


On Thu, Jan 5, 2023 at 5:03 PM Ioana Ciornei <ioana.ciornei at nxp.com> wrote:
>
> Some of the global variables were being initialised either to NULL or 0.
> This is not needed, just remove the it.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei at nxp.com>
> ---
>  drivers/net/fsl-mc/mc.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
> index 440273a17562..001c77ba8355 100644
> --- a/drivers/net/fsl-mc/mc.c
> +++ b/drivers/net/fsl-mc/mc.c
> @@ -57,14 +57,14 @@ static int mc_dpl_applied = -1;
>  #ifdef CFG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
>  static int mc_aiop_applied = -1;
>  #endif
> -struct fsl_mc_io *root_mc_io = NULL;
> -struct fsl_mc_io *dflt_mc_io = NULL; /* child container */
> -uint16_t root_dprc_handle = 0;
> -uint16_t dflt_dprc_handle = 0;
> +struct fsl_mc_io *root_mc_io;
> +struct fsl_mc_io *dflt_mc_io;
> +uint16_t root_dprc_handle;
> +uint16_t dflt_dprc_handle;
>  int child_dprc_id;
> -struct fsl_dpbp_obj *dflt_dpbp = NULL;
> -struct fsl_dpio_obj *dflt_dpio = NULL;
> -struct fsl_dpni_obj *dflt_dpni = NULL;
> +struct fsl_dpbp_obj *dflt_dpbp;
> +struct fsl_dpio_obj *dflt_dpio;
> +struct fsl_dpni_obj *dflt_dpni;
>  static u64 mc_lazy_dpl_addr;
>  static u32 dpsparser_obj_id;
>  static u16 dpsparser_handle;
> --
> 2.25.1
>
I don't believe it's a bad habit to initialize static variables. it's
true that they will be initialized to zero by default.
But I don't find this patch helpful in any way for understanding or
decluttering code.


More information about the U-Boot mailing list