mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings
@ 2020-04-12 14:25 carlosteniswarrior
  2020-04-12 16:56 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: carlosteniswarrior @ 2020-04-12 14:25 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Carlos Guerrero Alvarez

Fixed two checkpatch warnings.

Signed-off-by: Carlos Guerrero Alvarez <carlosteniswarrior@gmail.com>
---
 drivers/staging/comedi/drivers/jr3_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index c3c88e6d298f..6bc87d3c6c3b 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -91,8 +91,8 @@ struct jr3_pci_dev_private {
 };
 
 union jr3_pci_single_range {
-	struct comedi_lrange l;
-	char _reserved[offsetof(struct comedi_lrange, range[1])];
+	const comedi_lrange l;
+	char _reserved[offsetof(const comedi_lrange, range[1])];
 };
 
 enum jr3_pci_poll_state {
-- 
2.26.0


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

* Re: [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings
  2020-04-12 14:25 [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings carlosteniswarrior
@ 2020-04-12 16:56 ` Joe Perches
  2020-04-12 17:18 ` kbuild test robot
  2020-04-13 12:54 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-04-12 16:56 UTC (permalink / raw)
  To: carlosteniswarrior, gregkh; +Cc: devel, linux-kernel

On Sun, 2020-04-12 at 16:25 +0200, carlosteniswarrior@gmail.com wrote:
> Fixed two checkpatch warnings.

by introducing compiler errors.

> diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
[]
> @@ -91,8 +91,8 @@ struct jr3_pci_dev_private {
>  };
 
>  union jr3_pci_single_range {
> -	struct comedi_lrange l;
> -	char _reserved[offsetof(struct comedi_lrange, range[1])];
> +	const comedi_lrange l;
> +	char _reserved[offsetof(const comedi_lrange, range[1])];
>  };

try this:

$ make allyesconfig
$ make drivers/staging/comedi/drivers/jr3_pci.o

_always_ compile the files modified by your patch before
you post it to a mailing list or submit it to a maintainer.



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

* Re: [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings
  2020-04-12 14:25 [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings carlosteniswarrior
  2020-04-12 16:56 ` Joe Perches
@ 2020-04-12 17:18 ` kbuild test robot
  2020-04-13 12:54 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2020-04-12 17:18 UTC (permalink / raw)
  To: carlosteniswarrior
  Cc: kbuild-all, gregkh, devel, linux-kernel, Carlos Guerrero Alvarez

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

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.6 next-20200412]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/carlosteniswarrior-gmail-com/Staging-comedi-drivers-jr3_pci-fixed-two-warnings/20200412-234205
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git f4f7714f055fa662cf2f27dd0809a8781538e780
config: alpha-allmodconfig (attached as .config)
compiler: alpha-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
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=alpha 

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

All error/warnings (new ones prefixed by >>):

>> drivers/staging/comedi/drivers/jr3_pci.c:94:8: error: unknown type name 'comedi_lrange'
      94 |  const comedi_lrange l;
         |        ^~~~~~~~~~~~~
   In file included from <command-line>:
   drivers/staging/comedi/drivers/jr3_pci.c:95:32: error: unknown type name 'comedi_lrange'
      95 |  char _reserved[offsetof(const comedi_lrange, range[1])];
         |                                ^~~~~~~~~~~~~
   include/linux/compiler_types.h:129:54: note: in definition of macro '__compiler_offsetof'
     129 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
         |                                                      ^
>> drivers/staging/comedi/drivers/jr3_pci.c:95:17: note: in expansion of macro 'offsetof'
      95 |  char _reserved[offsetof(const comedi_lrange, range[1])];
         |                 ^~~~~~~~
   drivers/staging/comedi/drivers/jr3_pci.c: In function 'jr3_pci_poll_subdevice':
>> drivers/staging/comedi/drivers/jr3_pci.c:527:10: error: request for member 'range' in something not a structure or union
     527 |    r[0].l.range[0].min = -get_s16(&fs->fx) * 1000;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:528:10: error: request for member 'range' in something not a structure or union
     528 |    r[0].l.range[0].max = get_s16(&fs->fx) * 1000;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:529:10: error: request for member 'range' in something not a structure or union
     529 |    r[1].l.range[0].min = -get_s16(&fs->fy) * 1000;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:530:10: error: request for member 'range' in something not a structure or union
     530 |    r[1].l.range[0].max = get_s16(&fs->fy) * 1000;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:531:10: error: request for member 'range' in something not a structure or union
     531 |    r[2].l.range[0].min = -get_s16(&fs->fz) * 1000;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:532:10: error: request for member 'range' in something not a structure or union
     532 |    r[2].l.range[0].max = get_s16(&fs->fz) * 1000;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:533:10: error: request for member 'range' in something not a structure or union
     533 |    r[3].l.range[0].min = -get_s16(&fs->mx) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:534:10: error: request for member 'range' in something not a structure or union
     534 |    r[3].l.range[0].max = get_s16(&fs->mx) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:535:10: error: request for member 'range' in something not a structure or union
     535 |    r[4].l.range[0].min = -get_s16(&fs->my) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:536:10: error: request for member 'range' in something not a structure or union
     536 |    r[4].l.range[0].max = get_s16(&fs->my) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:537:10: error: request for member 'range' in something not a structure or union
     537 |    r[5].l.range[0].min = -get_s16(&fs->mz) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:539:10: error: request for member 'range' in something not a structure or union
     539 |    r[5].l.range[0].max = get_s16(&fs->mz) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:540:10: error: request for member 'range' in something not a structure or union
     540 |    r[6].l.range[0].min = -get_s16(&fs->v1) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:541:10: error: request for member 'range' in something not a structure or union
     541 |    r[6].l.range[0].max = get_s16(&fs->v1) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:542:10: error: request for member 'range' in something not a structure or union
     542 |    r[7].l.range[0].min = -get_s16(&fs->v2) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:543:10: error: request for member 'range' in something not a structure or union
     543 |    r[7].l.range[0].max = get_s16(&fs->v2) * 100;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:544:10: error: request for member 'range' in something not a structure or union
     544 |    r[8].l.range[0].min = 0;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c:545:10: error: request for member 'range' in something not a structure or union
     545 |    r[8].l.range[0].max = 65535;
         |          ^
   drivers/staging/comedi/drivers/jr3_pci.c: In function 'jr3_pci_alloc_spriv':
>> drivers/staging/comedi/drivers/jr3_pci.c:636:20: error: request for member 'length' in something not a structure or union
     636 |   spriv->range[j].l.length = 1;
         |                    ^
   drivers/staging/comedi/drivers/jr3_pci.c:637:20: error: request for member 'range' in something not a structure or union
     637 |   spriv->range[j].l.range[0].min = -1000000;
         |                    ^
   drivers/staging/comedi/drivers/jr3_pci.c:638:20: error: request for member 'range' in something not a structure or union
     638 |   spriv->range[j].l.range[0].max = 1000000;
         |                    ^
>> drivers/staging/comedi/drivers/jr3_pci.c:641:39: error: assignment to 'const struct comedi_lrange *' from incompatible pointer type 'const int *' [-Werror=incompatible-pointer-types]
     641 |    spriv->range_table_list[j + k * 8] = &spriv->range[j].l;
         |                                       ^
   drivers/staging/comedi/drivers/jr3_pci.c:645:19: error: request for member 'length' in something not a structure or union
     645 |  spriv->range[8].l.length = 1;
         |                   ^
   drivers/staging/comedi/drivers/jr3_pci.c:646:19: error: request for member 'range' in something not a structure or union
     646 |  spriv->range[8].l.range[0].min = 0;
         |                   ^
   drivers/staging/comedi/drivers/jr3_pci.c:647:19: error: request for member 'range' in something not a structure or union
     647 |  spriv->range[8].l.range[0].max = 65535;
         |                   ^
   drivers/staging/comedi/drivers/jr3_pci.c:649:30: error: assignment to 'const struct comedi_lrange *' from incompatible pointer type 'const int *' [-Werror=incompatible-pointer-types]
     649 |  spriv->range_table_list[56] = &spriv->range[8].l;
         |                              ^
   drivers/staging/comedi/drivers/jr3_pci.c:650:30: error: assignment to 'const struct comedi_lrange *' from incompatible pointer type 'const int *' [-Werror=incompatible-pointer-types]
     650 |  spriv->range_table_list[57] = &spriv->range[8].l;
         |                              ^
   cc1: some warnings being treated as errors

vim +/comedi_lrange +94 drivers/staging/comedi/drivers/jr3_pci.c

    92	
    93	union jr3_pci_single_range {
  > 94		const comedi_lrange l;
  > 95		char _reserved[offsetof(const comedi_lrange, range[1])];
    96	};
    97	

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

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

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

* Re: [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings
  2020-04-12 14:25 [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings carlosteniswarrior
  2020-04-12 16:56 ` Joe Perches
  2020-04-12 17:18 ` kbuild test robot
@ 2020-04-13 12:54 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-04-13 12:54 UTC (permalink / raw)
  To: carlosteniswarrior; +Cc: devel, linux-kernel

On Sun, Apr 12, 2020 at 04:25:08PM +0200, carlosteniswarrior@gmail.com wrote:
> Fixed two checkpatch warnings.
> 
> Signed-off-by: Carlos Guerrero Alvarez <carlosteniswarrior@gmail.com>
> ---
>  drivers/staging/comedi/drivers/jr3_pci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
> index c3c88e6d298f..6bc87d3c6c3b 100644
> --- a/drivers/staging/comedi/drivers/jr3_pci.c
> +++ b/drivers/staging/comedi/drivers/jr3_pci.c
> @@ -91,8 +91,8 @@ struct jr3_pci_dev_private {
>  };
>  
>  union jr3_pci_single_range {
> -	struct comedi_lrange l;
> -	char _reserved[offsetof(struct comedi_lrange, range[1])];
> +	const comedi_lrange l;
> +	char _reserved[offsetof(const comedi_lrange, range[1])];
>  };

Please work on your knowledge of C first, before modifying Linux kernel
code.  Mistakes like this show you need a bit more work there first.

Good luck!

greg k-h

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

end of thread, other threads:[~2020-04-13 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 14:25 [PATCH] Staging: comedi: drivers: jr3_pci: fixed two warnings carlosteniswarrior
2020-04-12 16:56 ` Joe Perches
2020-04-12 17:18 ` kbuild test robot
2020-04-13 12:54 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome