From: Lee Jones <lee.jones@linaro.org> To: arnd@arndb.de, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>, Stefan Roese <sr@denx.de> Subject: [PATCH 12/20] misc: lattice-ecp3-config: Remove set but clearly unused variable 'ret' Date: Mon, 29 Jun 2020 15:04:34 +0100 [thread overview] Message-ID: <20200629140442.1043957-13-lee.jones@linaro.org> (raw) In-Reply-To: <20200629140442.1043957-1-lee.jones@linaro.org> It's odd for the return value to be assigned to a variable so many times, but never actually checked, but this has been the case since the driver's inception in 2012. If it hasn't caused any issues by now, it's probably unlikely to. Let's take it out, at least until someone finds a reason to start using it. Fixes the following W=1 kernel build warning: drivers/misc/lattice-ecp3-config.c: In function ‘firmware_load’: drivers/misc/lattice-ecp3-config.c:70:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] 70 | int ret; | ^~~ Cc: Stefan Roese <sr@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/misc/lattice-ecp3-config.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 884485c3f7232..5eaf74447ca1e 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c @@ -67,7 +67,6 @@ static void firmware_load(const struct firmware *fw, void *context) struct spi_device *spi = (struct spi_device *)context; struct fpga_data *data = spi_get_drvdata(spi); u8 *buffer; - int ret; u8 txbuf[8]; u8 rxbuf[8]; int rx_len = 8; @@ -92,7 +91,7 @@ static void firmware_load(const struct firmware *fw, void *context) /* Trying to speak with the FPGA via SPI... */ txbuf[0] = FPGA_CMD_READ_ID; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); jedec_id = get_unaligned_be32(&rxbuf[4]); dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); @@ -110,7 +109,7 @@ static void firmware_load(const struct firmware *fw, void *context) dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); txbuf[0] = FPGA_CMD_READ_STATUS; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); status = get_unaligned_be32(&rxbuf[4]); dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); @@ -130,20 +129,20 @@ static void firmware_load(const struct firmware *fw, void *context) memcpy(buffer + 4, fw->data, fw->size); txbuf[0] = FPGA_CMD_REFRESH; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); txbuf[0] = FPGA_CMD_WRITE_EN; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); txbuf[0] = FPGA_CMD_CLEAR; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); /* * Wait for FPGA memory to become cleared */ for (i = 0; i < FPGA_CLEAR_LOOP_COUNT; i++) { txbuf[0] = FPGA_CMD_READ_STATUS; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); status = get_unaligned_be32(&rxbuf[4]); if (status == FPGA_STATUS_CLEARED) break; @@ -160,13 +159,13 @@ static void firmware_load(const struct firmware *fw, void *context) } dev_info(&spi->dev, "Configuring the FPGA...\n"); - ret = spi_write(spi, buffer, fw->size + 8); + spi_write(spi, buffer, fw->size + 8); txbuf[0] = FPGA_CMD_WRITE_DIS; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); txbuf[0] = FPGA_CMD_READ_STATUS; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); status = get_unaligned_be32(&rxbuf[4]); dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org> To: arnd@arndb.de, gregkh@linuxfoundation.org Cc: Stefan Roese <sr@denx.de>, Lee Jones <lee.jones@linaro.org>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/20] misc: lattice-ecp3-config: Remove set but clearly unused variable 'ret' Date: Mon, 29 Jun 2020 15:04:34 +0100 [thread overview] Message-ID: <20200629140442.1043957-13-lee.jones@linaro.org> (raw) In-Reply-To: <20200629140442.1043957-1-lee.jones@linaro.org> It's odd for the return value to be assigned to a variable so many times, but never actually checked, but this has been the case since the driver's inception in 2012. If it hasn't caused any issues by now, it's probably unlikely to. Let's take it out, at least until someone finds a reason to start using it. Fixes the following W=1 kernel build warning: drivers/misc/lattice-ecp3-config.c: In function ‘firmware_load’: drivers/misc/lattice-ecp3-config.c:70:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] 70 | int ret; | ^~~ Cc: Stefan Roese <sr@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/misc/lattice-ecp3-config.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 884485c3f7232..5eaf74447ca1e 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c @@ -67,7 +67,6 @@ static void firmware_load(const struct firmware *fw, void *context) struct spi_device *spi = (struct spi_device *)context; struct fpga_data *data = spi_get_drvdata(spi); u8 *buffer; - int ret; u8 txbuf[8]; u8 rxbuf[8]; int rx_len = 8; @@ -92,7 +91,7 @@ static void firmware_load(const struct firmware *fw, void *context) /* Trying to speak with the FPGA via SPI... */ txbuf[0] = FPGA_CMD_READ_ID; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); jedec_id = get_unaligned_be32(&rxbuf[4]); dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); @@ -110,7 +109,7 @@ static void firmware_load(const struct firmware *fw, void *context) dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); txbuf[0] = FPGA_CMD_READ_STATUS; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); status = get_unaligned_be32(&rxbuf[4]); dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); @@ -130,20 +129,20 @@ static void firmware_load(const struct firmware *fw, void *context) memcpy(buffer + 4, fw->data, fw->size); txbuf[0] = FPGA_CMD_REFRESH; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); txbuf[0] = FPGA_CMD_WRITE_EN; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); txbuf[0] = FPGA_CMD_CLEAR; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); /* * Wait for FPGA memory to become cleared */ for (i = 0; i < FPGA_CLEAR_LOOP_COUNT; i++) { txbuf[0] = FPGA_CMD_READ_STATUS; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); status = get_unaligned_be32(&rxbuf[4]); if (status == FPGA_STATUS_CLEARED) break; @@ -160,13 +159,13 @@ static void firmware_load(const struct firmware *fw, void *context) } dev_info(&spi->dev, "Configuring the FPGA...\n"); - ret = spi_write(spi, buffer, fw->size + 8); + spi_write(spi, buffer, fw->size + 8); txbuf[0] = FPGA_CMD_WRITE_DIS; - ret = spi_write(spi, txbuf, 4); + spi_write(spi, txbuf, 4); txbuf[0] = FPGA_CMD_READ_STATUS; - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); status = get_unaligned_be32(&rxbuf[4]); dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-29 21:20 UTC|newest] Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-29 14:04 [PATCH 00/20] Fix a bunch more W=1 warnings in Misc Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` [PATCH 01/20] misc: pti: Repair kerneldoc formatting issues Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` [PATCH 02/20] misc: pti: Remove unparsable empty line in function header Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` [PATCH 03/20] misc: habanalabs: firmware_if: Add missing 'fw_name' and 'dst' entries to " Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:57 ` Oded Gabbay 2020-06-29 14:57 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 04/20] misc: habanalabs: pci: Fix a variety of kerneldoc issues Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:58 ` Oded Gabbay 2020-06-29 14:58 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 05/20] misc: habanalabs: irq: Repair kerneldoc formatting issues Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:59 ` Oded Gabbay 2020-06-29 14:59 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 06/20] misc: habanalabs: goya: Omit pointless check ensuring addr is >=0 Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 15:00 ` Oded Gabbay 2020-06-29 15:00 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 07/20] misc: habanalabs: pci: Scrub documentation for non-present function argument Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 15:00 ` Oded Gabbay 2020-06-29 15:00 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 08/20] misc: habanalabs: goya: goya_coresight: Remove set but unused variable 'val' Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 15:01 ` Oded Gabbay 2020-06-29 15:01 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 09/20] misc: habanalabs: gaudi: Remove ill placed asterisk from kerneldoc header Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 15:01 ` Oded Gabbay 2020-06-29 15:01 ` Oded Gabbay 2020-06-29 14:04 ` [PATCH 10/20] misc: habanalabs: gaudi: gaudi_security: Repair incorrectly named function arg Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 15:02 ` Oded Gabbay 2020-06-29 15:02 ` Oded Gabbay 2020-06-29 16:23 ` [PATCH v2 " Lee Jones 2020-06-29 16:23 ` Lee Jones 2020-06-29 14:04 ` [PATCH 11/20] misc: enclosure: Fix some kerneldoc anomalies Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` Lee Jones [this message] 2020-06-29 14:04 ` [PATCH 12/20] misc: lattice-ecp3-config: Remove set but clearly unused variable 'ret' Lee Jones 2020-06-29 14:04 ` [PATCH 13/20] misc: pch_phub: Provide descriptions for 'chip' argument Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` [PATCH 14/20] misc: pch_phub: Remove superfluous descriptions to non-existent args 'offset_address' Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` [PATCH 15/20] misc: enclosure: Update enclosure_remove_device() documentation to match reality Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-29 14:04 ` [PATCH 16/20] misc: genwqe: card_base: Remove set but unused variable 'rc' Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-30 7:17 ` haver 2020-06-30 7:17 ` haver 2020-06-30 7:42 ` Lee Jones 2020-06-30 7:42 ` Lee Jones 2020-06-30 8:03 ` haver 2020-06-30 8:03 ` haver 2020-06-30 8:12 ` Lee Jones 2020-06-30 8:12 ` Lee Jones 2020-06-29 14:04 ` [PATCH 17/20] misc: genwqe: card_base: Do not pass unused argument 'fatal_err' Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-30 7:35 ` haver 2020-06-30 7:35 ` haver 2020-06-30 9:10 ` Lee Jones 2020-06-30 9:10 ` Lee Jones 2020-06-30 9:54 ` haver 2020-06-30 9:54 ` haver 2020-06-30 14:00 ` Lee Jones 2020-06-30 14:00 ` Lee Jones 2020-06-29 14:04 ` [PATCH 18/20] misc: genwqe: card_base: Whole host of kerneldoc fixes Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-30 7:24 ` haver 2020-06-30 7:24 ` haver 2020-06-29 14:04 ` [PATCH 19/20] misc: genwqe: card_dev: " Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-30 7:25 ` haver 2020-06-30 7:25 ` haver 2020-06-29 14:04 ` [PATCH 20/20] misc: genwqe: card_utils: Whole a plethora of documentation issues Lee Jones 2020-06-29 14:04 ` Lee Jones 2020-06-30 7:26 ` haver 2020-06-30 7:26 ` haver
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200629140442.1043957-13-lee.jones@linaro.org \ --to=lee.jones@linaro.org \ --cc=arnd@arndb.de \ --cc=gregkh@linuxfoundation.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=sr@denx.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.