printk: remove obsolete dead assignment
Subsystems (2)
PATCH 1/1 printk: remove obsolete dead assignment
Commit 849f3127bb46 ("switch /dev/kmsg to ->write_iter()") refactored devkmsg_write() and left over a dead assignment on the variable 'len'.
Hence, make clang-analyzer warns:
kernel/printk/printk.c:744:4: warning: Value stored to 'len' is never read
[clang-analyzer-deadcode.DeadStores]
len -= endp - line;
^Simply remove this obsolete dead assignment here.
---
applies cleanly on current master and next-20201130
Petr, please pick this minor non-urgent clean-up patch.
kernel/printk/printk.c | 1 - 1 file changed, 1 deletion(-)
kernel/printk/printk.c +0 -1
@@ -741,7 +741,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)if (LOG_FACILITY (u) !=0 ) facility =LOG_FACILITY (u); endp++; - len -= endp - line; line = endp; } }
Signature · 1 line
2.17.1
Quoted 26 lines · Lukas Bulwahn
Commit
849f3127bb46("switch/dev/kmsgto ->write_iter()") refactoreddevkmsg_write()and left over a dead assignment on the variable 'len'.Hence, make clang-analyzer warns:
kernel/printk/printk.c:744:4: warning: Value stored to 'len' is never read[clang-analyzer-deadcode.DeadStores] len -= endp - line; ^Simply remove this obsolete dead assignment here.
Signed-off-by Lukas Bulwahn <[email protected]>---
applies cleanly on current master and next-20201130Petr, please pick this minor non-urgent clean-up patch.
kernel/printk/printk.c | 1 - 1 file changed, 1 deletion(-)kernel/printk/printk.c +0
-0
kernel/printk/printk.c static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from) · line 746
Quoted 7 lines
kernel/printk/printk.c +0
-1@@ -741,7 +741,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)if (LOG_FACILITY (u) !=0 ) facility =LOG_FACILITY (u); endp++; - len -= endp - line; line = endp; } }
Yup, it was used to write the trailing '\0'. But it is done earlier now. So, it is not longer needed.
Best Regards,
Petr
PS: I'll give it few days just in case anyone else would want to review it. I'll push it then unless anyone complains.
Sergey Senozhatsky
Reviewed-byQuoted 1 line · Petr Mladek
On Mon 2020-11-30 13:49:15, Lukas Bulwahn wrote:
[..]
Quoted 16 lines
kernel/printk/printk.c static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from) · line 746
Quoted 12 lines
kernel/printk/printk.c +0
-1@@ -741,7 +741,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)if (LOG_FACILITY (u) !=0 ) facility =LOG_FACILITY (u); endp++; - len -= endp - line; line = endp; } }Yup, it was used to write the trailing '\0'. But it is done earlier now. So, it is not longer needed.
Quoted 7 lines
Reviewed-by Petr Mladek <[email protected]>Best Regards,
PetrPS: I'll give it few days just in case anyone else would want to review it. I'll push it then unless anyone complains.
FWIW, looks good to me
-ss
Petr Mladek
maintainerQuoted 5 lines · Lukas Bulwahn
Commit
849f3127bb46("switch/dev/kmsgto ->write_iter()") refactoreddevkmsg_write()and left over a dead assignment on the variable 'len'.Hence, make clang-analyzer warns:
Quoted 8 lines
kernel/printk/printk.c:744:4: warning: Value stored to 'len' is never read[clang-analyzer-deadcode.DeadStores] len -= endp - line; ^Simply remove this obsolete dead assignment here.
Signed-off-by Lukas Bulwahn <[email protected]>
The patch is committed in printk/linux.git, branch for-5.11.
Best Regards,
Petr