* [PATCH] watchdog-test.c: Remove unused variable in main
@ 2025-08-12 7:53 bajing
2025-08-12 19:27 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: bajing @ 2025-08-12 7:53 UTC (permalink / raw)
To: shuah; +Cc: lizhijian, linux-kselftest, linux-kernel, bajing
Since $optind is not used in the subsequent code, the variable
should be removed.
Signed-off-by: bajing <bajing@cmss.chinamobile.com>
---
tools/testing/selftests/watchdog/watchdog-test.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index a1f506ba5578..837001a9e3a0 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -209,8 +209,6 @@ int main(int argc, char *argv[])
exit(ret);
}
- optind = 0;
-
while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
switch (c) {
case 'b':
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog-test.c: Remove unused variable in main
2025-08-12 7:53 [PATCH] watchdog-test.c: Remove unused variable in main bajing
@ 2025-08-12 19:27 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2025-08-12 19:27 UTC (permalink / raw)
To: bajing, shuah; +Cc: lizhijian, linux-kselftest, linux-kernel, Shuah Khan
On 8/12/25 01:53, bajing wrote:
> Since $optind is not used in the subsequent code, the variable
> should be removed.
>
> Signed-off-by: bajing <bajing@cmss.chinamobile.com>
> ---
> tools/testing/selftests/watchdog/watchdog-test.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
> index a1f506ba5578..837001a9e3a0 100644
> --- a/tools/testing/selftests/watchdog/watchdog-test.c
> +++ b/tools/testing/selftests/watchdog/watchdog-test.c
> @@ -209,8 +209,6 @@ int main(int argc, char *argv[])
> exit(ret);
> }
>
> - optind = 0;
Removing the assignment soles based on looking at the subsequent
is incorrect.
Explain why this needs to be removed? Did you happen to check
getopt_long() and how it uses optind before making this change?
> -
> while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
> switch (c) {
> case 'b':
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-12 19:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 7:53 [PATCH] watchdog-test.c: Remove unused variable in main bajing
2025-08-12 19:27 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).