Message ID | 168236639399.1027628.5866455518934998684.stgit@dwillia2-xfh.jf.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 9c8759cced5211335b2630930c58d9be96fbbfc4 |
Headers | show |
Series | cxl list and test fixes | expand |
On 4/24/23 12:59 PM, Dan Williams wrote: > gcc (13.0.1 20230421 (Red Hat 13.0.1-0)) complains: > > ../test/libndctl.c: In function ‘check_commands’: > ../test/libndctl.c:2313:20: warning: storing the address of local variable > ‘__check_dimm_cmds’ in ‘check_cmds’ [-Wdangling-poiter=] > > ...fix it by showing the compiler that the local setting does not escape > the function. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> > --- > test/libndctl.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/test/libndctl.c b/test/libndctl.c > index 51245cf4ea98..858110c4dbc1 100644 > --- a/test/libndctl.c > +++ b/test/libndctl.c > @@ -2322,7 +2322,8 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm, > ndctl_bus_get_provider(bus), > ndctl_dimm_get_id(dimm), > ndctl_dimm_get_cmd_name(dimm, i)); > - return -ENXIO; > + rc = -ENXIO; > + break; > } > > if (!check->check_fn) > @@ -2331,6 +2332,7 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm, > if (rc) > break; > } > + check_cmds = NULL; > > for (i = 0; i < ARRAY_SIZE(__check_dimm_cmds); i++) { > if (__check_dimm_cmds[i].cmd) > >
diff --git a/test/libndctl.c b/test/libndctl.c index 51245cf4ea98..858110c4dbc1 100644 --- a/test/libndctl.c +++ b/test/libndctl.c @@ -2322,7 +2322,8 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm, ndctl_bus_get_provider(bus), ndctl_dimm_get_id(dimm), ndctl_dimm_get_cmd_name(dimm, i)); - return -ENXIO; + rc = -ENXIO; + break; } if (!check->check_fn) @@ -2331,6 +2332,7 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm, if (rc) break; } + check_cmds = NULL; for (i = 0; i < ARRAY_SIZE(__check_dimm_cmds); i++) { if (__check_dimm_cmds[i].cmd)
gcc (13.0.1 20230421 (Red Hat 13.0.1-0)) complains: ../test/libndctl.c: In function ‘check_commands’: ../test/libndctl.c:2313:20: warning: storing the address of local variable ‘__check_dimm_cmds’ in ‘check_cmds’ [-Wdangling-poiter=] ...fix it by showing the compiler that the local setting does not escape the function. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- test/libndctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)