diff mbox series

[4/4] phb4: Use the return value of phb4_fenced() in phb4_get_diag_data()

Message ID 20171109004411.9193-5-cyril.bur@au1.ibm.com
State Accepted
Headers show
Series Bug fix and coverity fixes | expand

Commit Message

Cyril Bur Nov. 9, 2017, 12:44 a.m. UTC
phb4_get_diag_data() checks the flags for the PHB4_AIB_FENCED after
having called phb4_fenced(). This information is returned by
phb4_fenced().

This patch was prompted by an unused return value warning in Coverity.

Fixes: CID 163734
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
---
Fair warning, I know nothing about PCI. This patch just seems to make
sense. It might be perfectly valid that we should tell Coverity that
this is done on purpose and to go away.
---
 hw/phb4.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Stewart Smith Aug. 7, 2018, 2:57 a.m. UTC | #1
Cyril Bur <cyril.bur@au1.ibm.com> writes:
> phb4_get_diag_data() checks the flags for the PHB4_AIB_FENCED after
> having called phb4_fenced(). This information is returned by
> phb4_fenced().
>
> This patch was prompted by an unused return value warning in Coverity.
>
> Fixes: CID 163734
> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
> ---
> Fair warning, I know nothing about PCI. This patch just seems to make
> sense. It might be perfectly valid that we should tell Coverity that
> this is done on purpose and to go away.

So, Cyril's address here is going to bounce, but I poked Russell to
confirm that this looked okay, so I merged it as of
0d96d56298d5a918f60babbf5ae26a8a74e8183d and now we get to find out how
wrong we all were :)
diff mbox series

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index a537efe8..1b369d7b 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -3467,6 +3467,7 @@  static int64_t phb4_get_diag_data(struct phb *phb,
 				  void *diag_buffer,
 				  uint64_t diag_buffer_len)
 {
+	bool fenced;
 	struct phb4 *p = phb_to_phb4(phb);
 	struct OpalIoPhb4ErrorData *data = diag_buffer;
 
@@ -3479,10 +3480,10 @@  static int64_t phb4_get_diag_data(struct phb *phb,
 	 * Dummy check for fence so that phb4_read_phb_status knows
 	 * whether to use ASB or AIB
 	 */
-	phb4_fenced(p);
+	fenced = phb4_fenced(p);
 	phb4_read_phb_status(p, data);
 
-	if (!(p->flags & PHB4_AIB_FENCED))
+	if (!fenced)
 		phb4_eeh_dump_regs(p);
 
 	/*