Re: [PATCH 2/3] soc: ti: knav_qmss_queue: do device_node auto cleanup

Nathan Chancellor
2024-05-13T06:44:53Z

On Sun, May 12, 2024 at 03:56:22PM +0530, Kousik Sanagavarapu wrote:
> On Sat, May 11, 2024 at 06:12:39PM +0800, kernel test robot wrote:
> > Hi Kousik,
> >
> > kernel test robot noticed the following build errors:
> >
>
> [...]
>
> > All errors (new ones prefixed by >>):
> >
> > >> drivers/soc/ti/knav_qmss_queue.c:1853:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1840:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1835:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1831:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1822:4: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1826:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *queue_pools __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1818:4: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1826:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *queue_pools __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1810:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1826:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *queue_pools __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1813:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *pdsps __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1806:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1826:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *queue_pools __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1813:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *pdsps __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1795:3: error: cannot jump from this goto statement to its label
> > goto err;
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1855:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *regions __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1826:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *queue_pools __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1813:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *pdsps __free(device_node) =
> > ^
> > drivers/soc/ti/knav_qmss_queue.c:1801:22: note: jump bypasses initialization of variable with __attribute__((cleanup))
> > struct device_node *qmgrs __free(device_node) =
> > ^
> > 9 errors generated.
>
> Seems like gcc didn't catch this when I compiled locally.

FWIW, you may notice this as you do more conversions. The fact that GCC
does not warn at all is a GCC bug as far as I am aware (i.e., clang's
error is correct):

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91951

which has come up in other places:

https://lore.kernel.org/20240425174732.GA270911@dev-arch.thelio-3990X/

Cheers,
Nathan