Skip to content

Commit

Permalink
mm/damon/sysfs: eliminate potential uninitialized variable warning
Browse files Browse the repository at this point in the history
The "err" variable is not initialized if damon_target_has_pid(ctx) is
false and sys_target->regions->nr is zero.

Link: https://lkml.kernel.org/r/739e6aaf-a634-4e33-98a8-16546379ec9f@moroto.mountain
Fixes: 0bcd216c4741 ("mm/damon/sysfs: update monitoring target regions for online input commit")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Dan Carpenter authored and Andrew Morton committed Nov 15, 2023
1 parent b85ea95 commit 85c2cea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/damon/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 85c2cea

Please sign in to comment.