public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH RESEND] stm class: Remove unnecessary local variable in stm_write
@ 2026-01-26  0:43 Thorsten Blum
  2026-01-26  6:33 ` Alexander Shishkin
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2026-01-26  0:43 UTC (permalink / raw)
  To: Alexander Shishkin, Maxime Coquelin, Alexandre Torgue
  Cc: Thorsten Blum, linux-stm32, linux-arm-kernel, linux-kernel

The local variable 'err' and the corresponding if check in stm_write()
are unnecessary. Remove them.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/hwtracing/stm/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index cdba4e875b28..f3814e4ecf23 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -602,17 +602,11 @@ static ssize_t notrace
 stm_write(struct stm_device *stm, struct stm_output *output,
 	  unsigned int chan, const char *buf, size_t count, struct stm_source_data *source)
 {
-	int err;
-
 	/* stm->pdrv is serialized against policy_mutex */
 	if (!stm->pdrv)
 		return -ENODEV;
 
-	err = stm->pdrv->write(stm->data, output, chan, buf, count, source);
-	if (err < 0)
-		return err;
-
-	return err;
+	return stm->pdrv->write(stm->data, output, chan, buf, count, source);
 }
 
 static ssize_t stm_char_write(struct file *file, const char __user *buf,
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4



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

* Re: [PATCH RESEND] stm class: Remove unnecessary local variable in stm_write
  2026-01-26  0:43 Thorsten Blum
@ 2026-01-26  6:33 ` Alexander Shishkin
  2026-01-26  7:55   ` Thorsten Blum
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Shishkin @ 2026-01-26  6:33 UTC (permalink / raw)
  To: Thorsten Blum, Maxime Coquelin, Alexandre Torgue
  Cc: Thorsten Blum, linux-stm32, linux-arm-kernel, linux-kernel,
	alexander.shishkin

Thorsten Blum <thorsten.blum@linux.dev> writes:

> The local variable 'err' and the corresponding if check in stm_write()
> are unnecessary. Remove them.

Nice catch! Is this a result of manual code inspection or were any tools
used, an AI agent or a coccinelle script or whatnot?

Thanks,
--
Alex


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

* Re: [PATCH RESEND] stm class: Remove unnecessary local variable in stm_write
  2026-01-26  6:33 ` Alexander Shishkin
@ 2026-01-26  7:55   ` Thorsten Blum
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-01-26  7:55 UTC (permalink / raw)
  To: Alexander Shishkin
  Cc: Maxime Coquelin, Alexandre Torgue, linux-stm32, linux-arm-kernel,
	linux-kernel

On 26. Jan 2026, at 07:33, Alexander Shishkin wrote:
> Thorsten Blum <thorsten.blum@linux.dev> writes:
> 
>> The local variable 'err' and the corresponding if check in stm_write()
>> are unnecessary. Remove them.
> 
> Nice catch! Is this a result of manual code inspection or were any tools
> used, an AI agent or a coccinelle script or whatnot?

Manual code inspection. I think I stumbled upon it when I was working on

https://lore.kernel.org/lkml/20250909102512.694203-2-thorsten.blum@linux.dev/
https://lore.kernel.org/lkml/20250909102512.694203-4-thorsten.blum@linux.dev/

which are also still pending. Could you take a look at all three patches
while you're at it?

Thanks,
Thorsten



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

* [PATCH RESEND] stm class: Remove unnecessary local variable in stm_write
@ 2026-03-18  0:25 Thorsten Blum
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-03-18  0:25 UTC (permalink / raw)
  To: Alexander Shishkin, Maxime Coquelin, Alexandre Torgue
  Cc: Thorsten Blum, linux-stm32, linux-arm-kernel, linux-kernel

The local variable 'err' and the corresponding if check in stm_write()
are unnecessary. Remove them.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/hwtracing/stm/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 37584e786bb5..4e0ee8e2e2c3 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -602,17 +602,11 @@ static ssize_t notrace
 stm_write(struct stm_device *stm, struct stm_output *output,
 	  unsigned int chan, const char *buf, size_t count, struct stm_source_data *source)
 {
-	int err;
-
 	/* stm->pdrv is serialized against policy_mutex */
 	if (!stm->pdrv)
 		return -ENODEV;
 
-	err = stm->pdrv->write(stm->data, output, chan, buf, count, source);
-	if (err < 0)
-		return err;
-
-	return err;
+	return stm->pdrv->write(stm->data, output, chan, buf, count, source);
 }
 
 static ssize_t stm_char_write(struct file *file, const char __user *buf,


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

end of thread, other threads:[~2026-03-18  0:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  0:25 [PATCH RESEND] stm class: Remove unnecessary local variable in stm_write Thorsten Blum
  -- strict thread matches above, loose matches on Subject: below --
2026-01-26  0:43 Thorsten Blum
2026-01-26  6:33 ` Alexander Shishkin
2026-01-26  7:55   ` Thorsten Blum

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