All of lore.kernel.org
 help / color / mirror / Atom feed
* checkpatch suspected false positive
@ 2017-02-21 23:01 Tobin C. Harding
  2017-02-21 23:19 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Tobin C. Harding @ 2017-02-21 23:01 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel

Checkpatch may be giving a false positive of type CONST_STRUCT when
parsing files in drivers/staging/comedi/drivers.

$ pwd
build/kernel/linux-trees/gregKH/staging/

$ cd drivers/staging/comedi/drivers

$ checkpatch --terse --show-types *.c | grep CONST_STRUCT
addi_apci_3501.c:97: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const
das16.c:972: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const
das16.c:1006: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const
jr3_pci.c:659: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const
jr3_pci.c:667: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const
jr3_pci.c:668: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const
ni_670x.c:212: WARNING:CONST_STRUCT: struct comedi_lrange should normally be const

snippet from das16.c

/* get any user-defined input range */
if (pg_type == das16_pg_none && (min || max)) {
	struct comedi_lrange *lrange;
	struct comedi_krange *krange;

	/* allocate single-range range table */
	lrange = comedi_alloc_spriv(s, sizeof(*lrange) + sizeof(*krange));
	if (!lrange)
		return &range_unknown;

	/* initialize ai range */
	lrange->length = 1;
	krange = lrange->range;
	krange->min = min;
	krange->max = max;
	krange->flags = UNIT_volt;

	return lrange;
}

>From snippet it may be seen that struct comedi_lrange *lrange should
not be const.

In the event that I am in the wrong and checkpatch is correct please
feel free to bluntly correct me.

thanks,
Tobin.

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

end of thread, other threads:[~2017-02-21 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 23:01 checkpatch suspected false positive Tobin C. Harding
2017-02-21 23:19 ` Joe Perches
2017-02-21 23:52   ` Tobin C. Harding

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.