Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: gpid: fmh: Drop residue from fmh_gpid_fifo_read_countable()
@ 2024-10-15 20:09 Nathan Chancellor
  2024-10-16  7:59 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2024-10-15 20:09 UTC (permalink / raw)
  To: Dave Penkler, Greg Kroah-Hartman
  Cc: linux-staging, llvm, patches, Nathan Chancellor

Clang warns (or errors with CONFIG_WERROR=y):

  drivers/staging/gpib/fmh_gpib/fmh_gpib.c:970:43: error: variable 'residue' is uninitialized when used here [-Werror,-Wuninitialized]
    970 |                                 (int)(*bytes_read), (int)length, (int)residue);
        |                                                                       ^~~~~~~

residue is never initialized in this function and it is not used outside
of an error print. Just remove it altogether, as it is likely not
necessary in this function, as this same exact statement in present in
fmh_gpib_dma_read().

Fixes: 8e4841a0888c ("staging: gpib: Add Frank Mori Hess FPGA PCI GPIB driver")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/staging/gpib/fmh_gpib/fmh_gpib.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c
index 07c75ba8df7c53041e3cf013bb769677ac205381..0e27b3ef1a1df217b05de710412a683d5d381a25 100644
--- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c
+++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c
@@ -922,7 +922,6 @@ static int fmh_gpib_fifo_read_countable(gpib_board_t *board, uint8_t *buffer,
 	struct fmh_priv *e_priv = board->private_data;
 	struct nec7210_priv *nec_priv = &e_priv->nec7210_priv;
 	int retval = 0;
-	unsigned int residue;
 
 	//	printk("%s: enter, bus_address=0x%x, length=%i\n", __FUNCTION__,
 	// (unsigned)bus_address,
@@ -966,8 +965,8 @@ static int fmh_gpib_fifo_read_countable(gpib_board_t *board, uint8_t *buffer,
 		unsigned int data_value;
 
 		if ((*bytes_read) >= length) {
-			dev_err(board->dev, "unexpected extra bytes in rx fifo, discarding!  bytes_read=%d length=%d residue=%d\n",
-				(int)(*bytes_read), (int)length, (int)residue);
+			dev_err(board->dev, "unexpected extra bytes in rx fifo, discarding!  bytes_read=%d length=%d\n",
+				(int)(*bytes_read), (int)length);
 			break;
 		}
 		data_value = fifos_read(e_priv, FIFO_DATA_REG);
@@ -976,8 +975,8 @@ static int fmh_gpib_fifo_read_countable(gpib_board_t *board, uint8_t *buffer,
 			*end = 1;
 	}
 
-//	printk("\tbytes_read=%i, residue=%i, end=%i, retval=%i, wait_retval=%i\n",
-//		   *bytes_read, residue, *end, retval, wait_retval);
+//	printk("\tbytes_read=%i, end=%i, retval=%i, wait_retval=%i\n",
+//		   *bytes_read, *end, retval, wait_retval);
 
 	return retval;
 }

---
base-commit: e0eb7cc4d70d672cf9344916aba58136fd6e495e
change-id: 20241015-staging-gpib-fmh-fix-residue-used-uninitialized-b8bf21d9266e

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-16 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 20:09 [PATCH] staging: gpid: fmh: Drop residue from fmh_gpid_fifo_read_countable() Nathan Chancellor
2024-10-16  7:59 ` Greg Kroah-Hartman
2024-10-16 15:19   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox