Skip to contentSkip to conversation

stm class: remove unnecessary local variable in stm_write

PATCH RESEND In review Thorsten Blum 1 participant 2 messages May 8 – Jun 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 stm class: remove unnecessary local variable in stm_write

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

---
 drivers/hwtracing/stm/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/hwtracing/stm/core.c +1 -7
index f48c6a8a0654..edf3d69a84a9 100644
@@ -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,
#1 lore raw

Gentle ping?

Quoted 31 lines · Thorsten Blum

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

---
 drivers/hwtracing/stm/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/hwtracing/stm/core.c +1 -7
index f48c6a8a0654..edf3d69a84a9 100644
@@ -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,