* [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs
@ 2025-03-14 10:10 Dan Carpenter
2025-03-14 10:10 ` [PATCH 1/2] spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write() Dan Carpenter
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2025-03-14 10:10 UTC (permalink / raw)
To: Longbin Li; +Cc: linux-kernel, linux-spi, Mark Brown
Here are two fixes for Smatch warnings.
Dan Carpenter (2):
spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write()
spi: sg2044-nor: Fix uninitialized variable in probe
drivers/spi/spi-sg2044-nor.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--
2.47.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write()
2025-03-14 10:10 [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Dan Carpenter
@ 2025-03-14 10:10 ` Dan Carpenter
2025-03-14 10:31 ` Tudor Ambarus
2025-03-14 10:10 ` [PATCH 2/2] spi: sg2044-nor: fix uninitialized variable in probe Dan Carpenter
2025-03-18 15:22 ` [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Mark Brown
2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-03-14 10:10 UTC (permalink / raw)
To: Longbin Li; +Cc: Mark Brown, linux-spi, linux-kernel
The "ret" variable needs to be signed for the error handling to work.
It should be type int, since it only holds zero and negative error
codes.
Fixes: de16c322eefb ("spi: sophgo: add SG2044 SPI NOR controller driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/spi/spi-sg2044-nor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-sg2044-nor.c b/drivers/spi/spi-sg2044-nor.c
index 454153a63b42..baa4cf677663 100644
--- a/drivers/spi/spi-sg2044-nor.c
+++ b/drivers/spi/spi-sg2044-nor.c
@@ -216,7 +216,7 @@ static ssize_t sg2044_spifmc_write(struct sg2044_spifmc *spifmc,
size_t xfer_size;
const u8 *dout = op->data.buf.out;
int i, offset;
- size_t ret;
+ int ret;
u32 reg;
reg = sg2044_spifmc_init_reg(spifmc);
--
2.47.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/2] spi: sg2044-nor: fix uninitialized variable in probe
2025-03-14 10:10 [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Dan Carpenter
2025-03-14 10:10 ` [PATCH 1/2] spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write() Dan Carpenter
@ 2025-03-14 10:10 ` Dan Carpenter
2025-03-14 10:32 ` Tudor Ambarus
2025-03-18 15:22 ` [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Mark Brown
2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-03-14 10:10 UTC (permalink / raw)
To: Longbin Li; +Cc: Mark Brown, linux-spi, linux-kernel
The "base" pointer is uninitialized. It should be "spifmc->io_base"
instead.
Fixes: de16c322eefb ("spi: sophgo: add SG2044 SPI NOR controller driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/spi/spi-sg2044-nor.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-sg2044-nor.c b/drivers/spi/spi-sg2044-nor.c
index baa4cf677663..97d6b3a21d54 100644
--- a/drivers/spi/spi-sg2044-nor.c
+++ b/drivers/spi/spi-sg2044-nor.c
@@ -427,7 +427,6 @@ static int sg2044_spifmc_probe(struct platform_device *pdev)
{
struct spi_controller *ctrl;
struct sg2044_spifmc *spifmc;
- void __iomem *base;
int ret;
ctrl = devm_spi_alloc_host(&pdev->dev, sizeof(*spifmc));
@@ -447,8 +446,8 @@ static int sg2044_spifmc_probe(struct platform_device *pdev)
spifmc->ctrl = ctrl;
spifmc->io_base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(base))
- return PTR_ERR(base);
+ if (IS_ERR(spifmc->io_base))
+ return PTR_ERR(spifmc->io_base);
ctrl->num_chipselect = 1;
ctrl->dev.of_node = pdev->dev.of_node;
--
2.47.2
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs
2025-03-14 10:10 [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Dan Carpenter
2025-03-14 10:10 ` [PATCH 1/2] spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write() Dan Carpenter
2025-03-14 10:10 ` [PATCH 2/2] spi: sg2044-nor: fix uninitialized variable in probe Dan Carpenter
@ 2025-03-18 15:22 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-03-18 15:22 UTC (permalink / raw)
To: Longbin Li, Dan Carpenter; +Cc: linux-kernel, linux-spi
On Fri, 14 Mar 2025 13:10:04 +0300, Dan Carpenter wrote:
> Here are two fixes for Smatch warnings.
>
> Dan Carpenter (2):
> spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write()
> spi: sg2044-nor: Fix uninitialized variable in probe
>
> drivers/spi/spi-sg2044-nor.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/2] spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write()
commit: 16c6cac2463d57d3dc15057937fd7aedacff656e
[2/2] spi: sg2044-nor: fix uninitialized variable in probe
commit: a1d8f70954f69e333b252795808164839bb2e7cf
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-03-18 15:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14 10:10 [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Dan Carpenter
2025-03-14 10:10 ` [PATCH 1/2] spi: sg2044-nor: fix signedness bug in sg2044_spifmc_write() Dan Carpenter
2025-03-14 10:31 ` Tudor Ambarus
2025-03-14 10:10 ` [PATCH 2/2] spi: sg2044-nor: fix uninitialized variable in probe Dan Carpenter
2025-03-14 10:32 ` Tudor Ambarus
2025-03-18 15:22 ` [PATCH 0/2] spi: sg2044-nor: fix a couple static checker bugs Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®