diff options
author | Joel Stanley <joel@jms.id.au> | 2015-07-21 12:53:12 +0930 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-08-13 15:52:33 +1000 |
commit | 6bc3d9531e4428d9b5944b1b2edb8f91b95811c3 (patch) | |
tree | 6769a9db329abf394d8405ba6725c8f5008c0f96 /hw/chiptod.c | |
parent | eff042167b9e10a94b6f036f9a54e23b2978269a (diff) | |
download | skiboot-6bc3d9531e4428d9b5944b1b2edb8f91b95811c3.zip skiboot-6bc3d9531e4428d9b5944b1b2edb8f91b95811c3.tar.gz skiboot-6bc3d9531e4428d9b5944b1b2edb8f91b95811c3.tar.bz2 |
fsp/chiptod: Fix initialised variable
If chiptod_adjust_topology returned true, rc would be uninitialised and the
message type passed to fsp_mkmsg would be undefined.
This also changes chiptod_adjust_topology to return true/false instead
of -1 and 0.
hw/fsp/fsp-chiptod.c:45:7: error: variable 'rc' is used uninitialized whenever
'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (chiptod_adjust_topology(topo, action) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/fsp/fsp-chiptod.c:48:50: note: uninitialized use occurs here
resp = fsp_mkmsg(FSP_RSP_TOPO_ENABLE_DISABLE | rc, 0);
^~
hw/fsp/fsp-chiptod.c:45:3: note: remove the 'if' if its condition is always true
if (chiptod_adjust_topology(topo, action) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/fsp/fsp-chiptod.c:30:12: note: initialize the variable 'rc' to silence this
warning
uint8_t rc;
^
= '\0'
Signed-off-by: Joel Stanley <joel@jms.id.au>
foo
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/chiptod.c')
-rw-r--r-- | hw/chiptod.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/chiptod.c b/hw/chiptod.c index bae4b50..69e05d9 100644 --- a/hw/chiptod.c +++ b/hw/chiptod.c @@ -1657,12 +1657,12 @@ static void chiptod_discover_new_backup(enum chiptod_topology topo) * topology. * * Return values: - * 0 <= Success - * -1 <= Topology is active and in use. + * true <= Success + * false <= Topology is active and in use. */ -int chiptod_adjust_topology(enum chiptod_topology topo, bool enable) +bool chiptod_adjust_topology(enum chiptod_topology topo, bool enable) { - uint8_t rc = 0; + uint8_t rc = true; /* * The FSP can only request that the currently inactive topology * be disabled or enabled. If the requested topology is currently @@ -1671,7 +1671,7 @@ int chiptod_adjust_topology(enum chiptod_topology topo, bool enable) */ lock(&chiptod_lock); if (topo == current_topology) { - rc = -1; + rc = false; goto out; } |