[PATCH v7 3/4] powerpc/pseries: Implement indexed-count hotplug memory add

Michael Ellerman mpe at ellerman.id.au
Fri Feb 17 17:58:59 AEDT 2017


Nathan Fontenot <nfont at linux.vnet.ibm.com> writes:

> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index 9609a72..0d1aa77 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -810,9 +901,6 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
>  	u32 count, drc_index;
>  	int rc;
>  
> -	count = hp_elog->_drc_u.drc_count;
> -	drc_index = hp_elog->_drc_u.drc_index;
        ^^^

This fails to build for me because of the above removal, ...


> @@ -829,20 +917,32 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
>  
...
>  		break;
>  	case PSERIES_HP_ELOG_ACTION_READD:
>  		rc = dlpar_memory_readd_by_index(drc_index, prop);
						 ^^^
And the existing usage here.


Which leads to:


  arch/powerpc/platforms/pseries/hotplug-memory.c: In function ‘dlpar_memory’:
  arch/powerpc/platforms/pseries/hotplug-memory.c:581:6: error: ‘drc_index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (lmbs[i].drc_index == drc_index) {
  ^

Presumably you're using an old compiler that didn't pick that up? If so
please update to a more modern compiler.


I did the obvious fix, hopefully it is correct:

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index bc73546587e7..e28abfa013e5 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -1019,6 +1019,7 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
 
 		break;
 	case PSERIES_HP_ELOG_ACTION_READD:
+		drc_index = hp_elog->_drc_u.drc_index;
 		rc = dlpar_memory_readd_by_index(drc_index, prop);
 		break;
 	default:

cheers


More information about the Linuxppc-dev mailing list