[LTP] [PATCH 1/2] cgroup: Fix build with -Werror=return-type

Petr Vorel pvorel@suse.com
Mon Jun 22 11:22:13 CEST 2020


Hi Li,

> >         tst_brk(TCONF, "Cgroup is not configured");
> > +       return TST_CGROUP_V1; /* fix -Werror=return-type */


> This return looks strange since it will never go to here.

> How about this?

I'm sorry, I overlooked your mail and push whole patchset.

LGTM, feel free to merge.
Tested-by: Petr Vorel <pvorel@suse.cz>

> enum tst_cgroup_ver tst_cgroup_version(void)
> {
>         enum tst_cgroup_ver cg_ver;

>         if (tst_cgroup_check("cgroup2")) {
>                 if (!tst_is_mounted("cgroup2") && tst_is_mounted("cgroup"))
>                         cg_ver = TST_CGROUP_V1;
>                 else
>                         cg_ver = TST_CGROUP_V2;

>                 goto out;
>         }

>         if (tst_cgroup_check("cgroup"))
>                 cg_ver = TST_CGROUP_V1;

>         if (!tg_ver)
Typo:
         if (!cg_ver)
>                 tst_brk(TCONF, "Cgroup is not configured");

> out:
>         return cg_ver;
> }

Kind regards,
Petr


More information about the ltp mailing list