All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
@ 2021-04-23 15:06 Guenter Roeck
  2021-04-23 17:31 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Guenter Roeck @ 2021-04-23 15:06 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, Guenter Roeck, Laurent Pinchart, Felipe Balbi,
	Greg Kroah-Hartman

The parameters passed to allow_link and drop_link functions are never NULL.
That means the result of container_of() on those parameters is also
never NULL, even if the reference into the structure points to the first
element of the structure. Remove the subsequent NULL checks.

The changes in this patch were made automatically using the following
Coccinelle script.

@@
type t;
identifier v;
statement s;
@@

<+...
(
  t v = container_of(...);
|
  v = container_of(...);
)
  ...
  when != v
- if (\( !v \| v == NULL \) ) s
...+>

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
After the recent discussion about a patch which tried to add a check
against NULL after container_of(), I realized that there are a number
of such checks in the kernel.

Now the big question: Are patches like this acceptable, or do they count
as noise ?

Guenter

 drivers/usb/gadget/function/uvc_configfs.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 00fb58e50a15..b9d1bcb4f4ff 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -914,8 +914,6 @@ static int uvcg_streaming_header_allow_link(struct config_item *src,
 
 	target_fmt = container_of(to_config_group(target), struct uvcg_format,
 				  group);
-	if (!target_fmt)
-		goto out;
 
 	uvcg_format_set_indices(to_config_group(target));
 
@@ -955,8 +953,6 @@ static void uvcg_streaming_header_drop_link(struct config_item *src,
 	mutex_lock(&opts->lock);
 	target_fmt = container_of(to_config_group(target), struct uvcg_format,
 				  group);
-	if (!target_fmt)
-		goto out;
 
 	list_for_each_entry_safe(format_ptr, tmp, &src_hdr->formats, entry)
 		if (format_ptr->fmt == target_fmt) {
-- 
2.17.1


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

* Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
  2021-04-23 15:06 [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Guenter Roeck
@ 2021-04-23 17:31 ` kernel test robot
  2021-04-24  6:01 ` Greg Kroah-Hartman
  2021-04-24  8:03 ` Felipe Balbi
  2 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-04-23 17:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 11401 bytes --]

Hi Guenter,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Guenter-Roeck/usb-gadget-Drop-unnecessary-NULL-checks-after-container_of/20210423-230821
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: powerpc-randconfig-r013-20210423 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 06234f758e1945084582cf80450b396f75a9c06e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/cbd5fdce089022e1d479b647580489e84d92ca5e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Guenter-Roeck/usb-gadget-Drop-unnecessary-NULL-checks-after-container_of/20210423-230821
        git checkout cbd5fdce089022e1d479b647580489e84d92ca5e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:186:1: note: expanded from here
   __do_insb
   ^
   arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
   #define __do_insb(p, b, n)      readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/usb/gadget/function/uvc_configfs.c:15:
   In file included from drivers/usb/gadget/function/u_uvc.h:17:
   In file included from include/linux/usb/composite.h:41:
   In file included from include/linux/usb/gadget.h:25:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:188:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/usb/gadget/function/uvc_configfs.c:15:
   In file included from drivers/usb/gadget/function/u_uvc.h:17:
   In file included from include/linux/usb/composite.h:41:
   In file included from include/linux/usb/gadget.h:25:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:190:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/usb/gadget/function/uvc_configfs.c:15:
   In file included from drivers/usb/gadget/function/u_uvc.h:17:
   In file included from include/linux/usb/composite.h:41:
   In file included from include/linux/usb/gadget.h:25:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:192:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/usb/gadget/function/uvc_configfs.c:15:
   In file included from drivers/usb/gadget/function/u_uvc.h:17:
   In file included from include/linux/usb/composite.h:41:
   In file included from include/linux/usb/gadget.h:25:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:194:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/usb/gadget/function/uvc_configfs.c:15:
   In file included from drivers/usb/gadget/function/u_uvc.h:17:
   In file included from include/linux/usb/composite.h:41:
   In file included from include/linux/usb/gadget.h:25:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:196:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> drivers/usb/gadget/function/uvc_configfs.c:967:1: warning: unused label 'out' [-Wunused-label]
   out:
   ^~~~
   13 warnings generated.


vim +/out +967 drivers/usb/gadget/function/uvc_configfs.c

46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  936  
e16769d4bca672 Andrzej Pietrasiewicz 2016-11-28  937  static void uvcg_streaming_header_drop_link(struct config_item *src,
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  938  					   struct config_item *target)
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  939  {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  940  	struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  941  	struct config_item *opts_item;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  942  	struct f_uvc_opts *opts;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  943  	struct uvcg_streaming_header *src_hdr;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  944  	struct uvcg_format *target_fmt = NULL;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  945  	struct uvcg_format_ptr *format_ptr, *tmp;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  946  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  947  	src_hdr = to_uvcg_streaming_header(src);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  948  	mutex_lock(su_mutex); /* for navigating configfs hierarchy */
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  949  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  950  	opts_item = src->ci_parent->ci_parent->ci_parent;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  951  	opts = to_f_uvc_opts(opts_item);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  952  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  953  	mutex_lock(&opts->lock);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  954  	target_fmt = container_of(to_config_group(target), struct uvcg_format,
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  955  				  group);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  956  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  957  	list_for_each_entry_safe(format_ptr, tmp, &src_hdr->formats, entry)
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  958  		if (format_ptr->fmt == target_fmt) {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  959  			list_del(&format_ptr->entry);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  960  			kfree(format_ptr);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  961  			--src_hdr->num_fmt;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  962  			break;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  963  		}
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  964  
cb2200f7af8341 Joel Pepper           2018-05-29  965  	--target_fmt->linked;
cb2200f7af8341 Joel Pepper           2018-05-29  966  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10 @967  out:
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  968  	mutex_unlock(&opts->lock);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  969  	mutex_unlock(su_mutex);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  970  }
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  971  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 44558 bytes --]

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

* Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
  2021-04-23 15:06 [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Guenter Roeck
  2021-04-23 17:31 ` kernel test robot
@ 2021-04-24  6:01 ` Greg Kroah-Hartman
  2021-04-24  8:03 ` Felipe Balbi
  2 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2021-04-24  6:01 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-usb, linux-kernel, Laurent Pinchart, Felipe Balbi

On Fri, Apr 23, 2021 at 08:06:26AM -0700, Guenter Roeck wrote:
> The parameters passed to allow_link and drop_link functions are never NULL.
> That means the result of container_of() on those parameters is also
> never NULL, even if the reference into the structure points to the first
> element of the structure. Remove the subsequent NULL checks.
> 
> The changes in this patch were made automatically using the following
> Coccinelle script.
> 
> @@
> type t;
> identifier v;
> statement s;
> @@
> 
> <+...
> (
>   t v = container_of(...);
> |
>   v = container_of(...);
> )
>   ...
>   when != v
> - if (\( !v \| v == NULL \) ) s
> ...+>
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> After the recent discussion about a patch which tried to add a check
> against NULL after container_of(), I realized that there are a number
> of such checks in the kernel.
> 
> Now the big question: Are patches like this acceptable, or do they count
> as noise ?

Yes they are acceptable, and no, they are not noise.

I will be glad to take this after -rc1 is out, thanks.

thanks,

greg k-h

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

* Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
  2021-04-23 15:06 [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Guenter Roeck
  2021-04-23 17:31 ` kernel test robot
  2021-04-24  6:01 ` Greg Kroah-Hartman
@ 2021-04-24  8:03 ` Felipe Balbi
  2021-04-24 22:07   ` Laurent Pinchart
  2 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2021-04-24  8:03 UTC (permalink / raw)
  To: Guenter Roeck, linux-usb
  Cc: linux-kernel, Guenter Roeck, Laurent Pinchart, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]


Hi Guenter,

Guenter Roeck <linux@roeck-us.net> writes:
> The parameters passed to allow_link and drop_link functions are never NULL.
> That means the result of container_of() on those parameters is also
> never NULL, even if the reference into the structure points to the first
> element of the structure. Remove the subsequent NULL checks.
>
> The changes in this patch were made automatically using the following
> Coccinelle script.
>
> @@
> type t;
> identifier v;
> statement s;
> @@
>
> <+...
> (
>   t v = container_of(...);
> |
>   v = container_of(...);
> )
>   ...
>   when != v
> - if (\( !v \| v == NULL \) ) s
> ...+>
>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> After the recent discussion about a patch which tried to add a check
> against NULL after container_of(), I realized that there are a number
> of such checks in the kernel.
>
> Now the big question: Are patches like this acceptable, or do they count
> as noise ?

Not noise in my book :-)

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

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

* Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
  2021-04-24  8:03 ` Felipe Balbi
@ 2021-04-24 22:07   ` Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2021-04-24 22:07 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Felipe Balbi, linux-usb, linux-kernel, Greg Kroah-Hartman

Hi Guenter,

On Sat, Apr 24, 2021 at 11:03:19AM +0300, Felipe Balbi wrote:
> Guenter Roeck <linux@roeck-us.net> writes:
> > The parameters passed to allow_link and drop_link functions are never NULL.
> > That means the result of container_of() on those parameters is also
> > never NULL, even if the reference into the structure points to the first
> > element of the structure. Remove the subsequent NULL checks.
> >
> > The changes in this patch were made automatically using the following
> > Coccinelle script.
> >
> > @@
> > type t;
> > identifier v;
> > statement s;
> > @@
> >
> > <+...
> > (
> >   t v = container_of(...);
> > |
> >   v = container_of(...);
> > )
> >   ...
> >   when != v
> > - if (\( !v \| v == NULL \) ) s
> > ...+>
> >
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Felipe Balbi <balbi@kernel.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > After the recent discussion about a patch which tried to add a check
> > against NULL after container_of(), I realized that there are a number
> > of such checks in the kernel.
> >
> > Now the big question: Are patches like this acceptable, or do they count
> > as noise ?
> 
> Not noise in my book :-)
> 
> Acked-by: Felipe Balbi <balbi@kernel.org>

Likewise,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

And thank you for the patch.

-- 
Regards,

Laurent Pinchart

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

* Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
@ 2021-04-23 19:13 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-04-23 19:13 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5146 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210423150626.138188-1-linux@roeck-us.net>
References: <20210423150626.138188-1-linux@roeck-us.net>
TO: Guenter Roeck <linux@roeck-us.net>

Hi Guenter,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next balbi-usb/testing/next v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Guenter-Roeck/usb-gadget-Drop-unnecessary-NULL-checks-after-container_of/20210423-230821
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: powerpc-randconfig-s031-20210423 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/cbd5fdce089022e1d479b647580489e84d92ca5e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Guenter-Roeck/usb-gadget-Drop-unnecessary-NULL-checks-after-container_of/20210423-230821
        git checkout cbd5fdce089022e1d479b647580489e84d92ca5e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/usb/gadget/function/uvc_configfs.c:967:1: sparse: sparse: unused label 'out'

vim +/out +967 drivers/usb/gadget/function/uvc_configfs.c

46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  936  
e16769d4bca672 Andrzej Pietrasiewicz 2016-11-28  937  static void uvcg_streaming_header_drop_link(struct config_item *src,
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  938  					   struct config_item *target)
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  939  {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  940  	struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  941  	struct config_item *opts_item;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  942  	struct f_uvc_opts *opts;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  943  	struct uvcg_streaming_header *src_hdr;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  944  	struct uvcg_format *target_fmt = NULL;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  945  	struct uvcg_format_ptr *format_ptr, *tmp;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  946  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  947  	src_hdr = to_uvcg_streaming_header(src);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  948  	mutex_lock(su_mutex); /* for navigating configfs hierarchy */
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  949  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  950  	opts_item = src->ci_parent->ci_parent->ci_parent;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  951  	opts = to_f_uvc_opts(opts_item);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  952  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  953  	mutex_lock(&opts->lock);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  954  	target_fmt = container_of(to_config_group(target), struct uvcg_format,
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  955  				  group);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  956  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  957  	list_for_each_entry_safe(format_ptr, tmp, &src_hdr->formats, entry)
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  958  		if (format_ptr->fmt == target_fmt) {
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  959  			list_del(&format_ptr->entry);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  960  			kfree(format_ptr);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  961  			--src_hdr->num_fmt;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  962  			break;
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  963  		}
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  964  
cb2200f7af8341 Joel Pepper           2018-05-29  965  	--target_fmt->linked;
cb2200f7af8341 Joel Pepper           2018-05-29  966  
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10 @967  out:
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  968  	mutex_unlock(&opts->lock);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  969  	mutex_unlock(su_mutex);
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  970  }
46919a23ee87bb Andrzej Pietrasiewicz 2014-12-10  971  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33613 bytes --]

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

end of thread, other threads:[~2021-04-24 22:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 15:06 [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Guenter Roeck
2021-04-23 17:31 ` kernel test robot
2021-04-24  6:01 ` Greg Kroah-Hartman
2021-04-24  8:03 ` Felipe Balbi
2021-04-24 22:07   ` Laurent Pinchart
2021-04-23 19:13 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.