linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/damon/sysfs: eliminate potential uninitialized variable warning
@ 2023-11-06 14:07 Dan Carpenter
  2023-11-06 14:41 ` SeongJae Park
  2023-11-06 19:05 ` Deepak R Varma
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2023-11-06 14:07 UTC (permalink / raw)
  To: SeongJae Park; +Cc: Andrew Morton, damon, linux-mm, kernel-janitors

The "err" variable is not initialized if damon_target_has_pid(ctx) is
false and sys_target->regions->nr is zero.

Fixes: 0bcd216c4741 ("mm/damon/sysfs: update monitoring target regions for online input commit")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 mm/damon/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index e27846708b5a..1dfa96d4de99 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1172,7 +1172,7 @@ static int damon_sysfs_update_target(struct damon_target *target,
 		struct damon_ctx *ctx,
 		struct damon_sysfs_target *sys_target)
 {
-	int err;
+	int err = 0;
 
 	if (damon_target_has_pid(ctx)) {
 		err = damon_sysfs_update_target_pid(target, sys_target->pid);
-- 
2.42.0



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

end of thread, other threads:[~2023-11-07  3:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06 14:07 [PATCH] mm/damon/sysfs: eliminate potential uninitialized variable warning Dan Carpenter
2023-11-06 14:41 ` SeongJae Park
2023-11-06 16:23   ` Dan Carpenter
2023-11-06 16:52     ` SeongJae Park
2023-11-07  3:54       ` Dan Carpenter
2023-11-06 19:05 ` Deepak R Varma
2023-11-06 20:49   ` SeongJae Park

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