RE: [PATCH] media: atomisp: silence "dubious: !x | !y" warning

2021-04-20 Thread David Laight
From: Dan Carpenter > Sent: 20 April 2021 11:28 > > On Sat, Apr 17, 2021 at 09:31:32PM +0000, David Laight wrote: > > From: Mauro Carvalho Chehab > > > Sent: 17 April 2021 19:56 > > > > > > Em Sat, 17 Apr 2021 21:06:27 +0530 > > > Ashish

RE: [PATCH] media: atomisp: silence "dubious: !x | !y" warning

2021-04-17 Thread David Laight
From: Mauro Carvalho Chehab > Sent: 17 April 2021 19:56 > > Em Sat, 17 Apr 2021 21:06:27 +0530 > Ashish Kalra escreveu: > > > Upon running sparse, "warning: dubious: !x | !y" is brought to notice > > for this file. Logical and bitwise OR are basically the same in this > > context so it doesn't

RE: [PATCH] staging: comedi: cast to (unsigned int *)

2021-02-19 Thread David Laight
From: Dan Carpenter > Sent: 19 February 2021 09:26 > > On Fri, Feb 19, 2021 at 09:03:59AM +0000, David Laight wrote: > > > It's kind of moot anyway because the patch is outdated. But the reason > > > for the ___force is that the same `struct comedi_cmd` is us

RE: [PATCH] staging: comedi: cast to (unsigned int *)

2021-02-19 Thread David Laight
> It's kind of moot anyway because the patch is outdated. But the reason > for the ___force is that the same `struct comedi_cmd` is used in both > user and kernel contexts. In user contexts, the `chanlist` member > points to user memory and in kernel contexts it points to kernel memory > (copied

RE: [PATCH v4] staging: gdm724x: Fix DMA from stack

2021-02-11 Thread David Laight
> Stack allocated buffers cannot be used for DMA > on all architectures so allocate hci_packet buffer > using kmalloc. I wonder if the usb stack ought/could support a short bounce buffer within the memory is already has to allocate? For hci and lengths less than 8 the immediate data can be placed

RE: [PATCH] media: allegro-dvt: Use __packed sentence

2021-01-29 Thread David Laight
From: Emmanuel Arias > Sent: 29 January 2021 20:02 > > Fix coding style using __packed sentece instead of > __attribute__((__packed__)). > > Signed-off-by: Emmanuel Arias > --- > drivers/staging/media/allegro-dvt/allegro-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff -

RE: [PATCH] staging: most: video: fixed a parentheses coding style issue.

2020-12-18 Thread David Laight
From: Joe Perches > Sent: 18 December 2020 10:09 > On Fri, 2020-12-18 at 09:49 +, David Laight wrote: > > From: Joe Perches > > checkpatch probably shouldn't complain about lines that end in ( > > if they are function definitions. > > Opinons vary.

RE: [PATCH] staging: most: video: fixed a parentheses coding style issue.

2020-12-18 Thread David Laight
From: Joe Perches > Sent: 17 December 2020 23:58 > > On Thu, 2020-12-17 at 15:45 -0800, Daniel West wrote: > > Fixed a coding style issue. > > It may pass checkpatch without warning, but it's uncommon kernel coding style. checkpatch probably shouldn't complain about lines that end in ( if they a

RE: [PATCH v2 12/12] media: atomisp: Fix LOGICAL_CONTINUATIONS

2020-12-14 Thread David Laight
From: Philipp Gerlesberger > Sent: 14 December 2020 11:02 > > Logical continuations should be on the previous line > > Co-developed-by: Andrey Khlopkov > Signed-off-by: Andrey Khlopkov > Signed-off-by: Philipp Gerlesberger > --- > drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c | 4

RE: [PATCH v2 09/12] media: atomisp: Fix PARENTHESIS_ALIGNMENT

2020-12-14 Thread David Laight
From: Philipp Gerlesberger > Sent: 14 December 2020 11:04 > > You can sum up the two lines, because the maximum line length of > 100 columns is not exceeded. IIRC the 80 column limit is preferred. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK

RE: [PATCH] media: staging: rkisp1: rsz: make const array static, makes object smaller

2020-10-20 Thread David Laight
From: Dafna Hirschfeld > Sent: 20 October 2020 18:10 > > Am 20.10.20 um 17:29 schrieb David Laight: > > From: Colin King > >> Sent: 20 October 2020 15:47 > >> > >> From: Colin Ian King > >> ... > >> diff --git a/drivers/staging/media/

RE: [PATCH] media: staging: rkisp1: rsz: make const array static, makes object smaller

2020-10-20 Thread David Laight
From: Colin King > Sent: 20 October 2020 15:47 > > From: Colin Ian King > > Don't populate the const array dev_names on the stack but instead it > static. Makes the object code smaller by 15 bytes. > > Before: >text data bss dec hex filename > 17091 2648

RE: [PATCH] staging: wfx: make a const array static, makes object smaller

2020-10-19 Thread David Laight
From: Joe Perches > Sent: 17 October 2020 01:12 > > On Fri, 2020-10-16 at 23:33 +0100, Colin King wrote: > > From: Colin Ian King > > > > Don't populate const array filter_ies on the stack but instead > > make it static. Makes the object code smaller by 261 bytes. > > > > Before: > >text

RE: [PATCH 1/8] staging: rtl8723bs: replace RND4 with round_up()

2020-10-04 Thread David Laight
From: Ross Schmidt > Sent: 04 October 2020 02:18 > > Use round_up instead of define RND4. RND4 was also particularly horrid! ... > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c > b/drivers/staging/rtl8723bs/core/rtw_security.c > index 7f74e1d05b3a..159d32ace2bc 100644 > --- a/drivers

RE: [PATCH 3/3] [PATCH] staging: greybus: __u8 is sufficient for snd_ctl_elem_type_t and snd_ctl_elem_iface_t

2020-09-26 Thread David Laight
From: Coiby Xu > Sent: 25 September 2020 15:11 > > On Thu, Sep 24, 2020 at 10:54:50AM +0000, David Laight wrote: > >From: Coiby Xu > >> Sent: 24 September 2020 11:21 > >> Use __8 to replace int and remove the unnecessary __bitwise type attribute. > >> &g

RE: [PATCH 3/3] [PATCH] staging: greybus: __u8 is sufficient for snd_ctl_elem_type_t and snd_ctl_elem_iface_t

2020-09-24 Thread David Laight
From: Coiby Xu > Sent: 24 September 2020 11:21 > Use __8 to replace int and remove the unnecessary __bitwise type attribute. > > Found by sparse, ... > diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h > index 535a7229e1d9..8e71a95644ab 100644 > --- a/include/uapi/sound/asound

RE: [PATCH 1/2] media: atomisp: fix gcc warnings

2020-09-23 Thread David Laight
From: Mauro Carvalho Chehab > Sent: 23 September 2020 09:22 > > Depending on the gcc version, after changeset > 72a9ff3bf7fb ("media: atomisp: get rid of -Wsuggest-attribute=format > warnings"), > we're now getting two warnings, which are breaking the Jenkins > CI instance at https://builder.linu

RE: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed

2020-08-21 Thread David Laight
From: Nicolas Boichat > Sent: 21 August 2020 13:07 ... > > You might also want a #define that can set temporarily > > to enable traces in a specific file/module even though > > CONFIG_TRACE=n. > > I don't understand how traces are supposed to work with CONFIG_TRACE=n? Probably because I meant som

RE: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed

2020-08-21 Thread David Laight
From: Nicolas Boichat > Sent: 21 August 2020 11:28 > > On Fri, Aug 21, 2020 at 4:48 PM David Laight wrote: > > > > From: Steven Rostedt > > > Sent: 21 August 2020 01:36 > > > On Fri, 21 Aug 2020 08:13:00 +0800 > > > Nicolas Boichat wrote: >

RE: [PATCH v4 3/3] media: atomisp: Only use trace_printk if allowed

2020-08-21 Thread David Laight
From: Steven Rostedt > Sent: 21 August 2020 01:36 > On Fri, 21 Aug 2020 08:13:00 +0800 > Nicolas Boichat wrote: > > > On Thu, Aug 20, 2020 at 10:23 PM Steven Rostedt wrote: > > > > > > On Thu, 20 Aug 2020 17:14:12 +0800 > > > Nicolas Boichat wrote: > > > > > > > Technically, we could only initi

RE: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls

2019-10-01 Thread David Laight
From: Denis Efremov > Sent: 01 October 2019 16:13 ... > Just found an official documentation to this issue: > https://gcc.gnu.org/gcc-4.9/porting_to.html > "Null pointer checks may be optimized away more aggressively > ... > The pointers passed to memmove (and similar functions in ) must be > non-

RE: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls

2019-10-01 Thread David Laight
> From: Dan Carpenter > Sent: 01 October 2019 14:57 > Subject: Re: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls ... > That's true for glibc memcpy() but not for the kernel memcpy(). In the > kernel there are lots of places which do a zero size memcpy(). And probably from NULL (or even garbag

RE: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls

2019-09-30 Thread David Laight
From: Denis Efremov > Sent: 30 September 2019 12:02 > memcpy() in phy_ConfigBBWithParaFile() and PHY_ConfigRFWithParaFile() is > called with "src == NULL && len == 0". This is an undefined behavior. I'm pretty certain it is well defined (to do nothing). > Moreover this if pre-condition "pBufLen &

RE: [PATCH] staging: exfat: cleanup braces for if/else statements

2019-09-04 Thread David Laight
From: Valentin Vidic > Sent: 03 September 2019 19:12 > On Tue, Sep 03, 2019 at 06:32:49PM +0100, Al Viro wrote: > > On Tue, Sep 03, 2019 at 06:47:32PM +0200, Valentin Vidic wrote: > > > + } else if (uni == 0x) { > > > skip = TRUE; > > > > While we are a

RE: [PATCH] rtl8712: rtl871x_ioctl_linux.c: fix unnecessary typecast

2019-08-06 Thread David Laight
From: Dan Carpenter > Sent: 06 August 2019 12:53 > On Mon, Aug 05, 2019 at 10:33:29PM -0300, Jose Carlos Cazarin Filho wrote: > > Fix checkpath warning: > > WARNING: Unnecessary typecast of c90 int constant > > > > Signed-off-by: Jose Carlos Cazarin Filho > > --- > > Hello all! > > This is my fi

RE: [PATCH 16/16] dma-mapping: use exact allocation in dma_alloc_contiguous

2019-06-14 Thread David Laight
From: Robin Murphy > Sent: 14 June 2019 16:06 ... > Well, apart from the bit in DMA-API-HOWTO which has said this since > forever (well, before Git history, at least): > > "The CPU virtual address and the DMA address are both > guaranteed to be aligned to the smallest PAGE_SIZE order which > is gr

RE: [PATCH 16/16] dma-mapping: use exact allocation in dma_alloc_contiguous

2019-06-14 Thread David Laight
From: 'Christoph Hellwig' > Sent: 14 June 2019 15:50 > To: David Laight > On Fri, Jun 14, 2019 at 02:15:44PM +, David Laight wrote: > > Does this still guarantee that requests for 16k will not cross a 16k > > boundary? > > It looks like you are losing the

RE: [PATCH 16/16] dma-mapping: use exact allocation in dma_alloc_contiguous

2019-06-14 Thread David Laight
From: Christoph Hellwig > Sent: 14 June 2019 14:47 > > Many architectures (e.g. arm, m68 and sh) have always used exact > allocation in their dma coherent allocator, which avoids a lot of > memory waste especially for larger allocations. Lift this behavior > into the generic allocator so that dma

RE: [PATCH v2 4/7] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

2019-05-08 Thread David Laight
From: Alastair D'Silva > Sent: 08 May 2019 08:02 > To: alast...@d-silva.org ... > --- a/include/linux/printk.h > +++ b/include/linux/printk.h > @@ -480,13 +480,13 @@ enum { > DUMP_PREFIX_OFFSET > }; > > -extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, > -

RE: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

2019-04-15 Thread David Laight
From: Alastair D'Silva > Sent: 15 April 2019 11:45 ... > > Although I think you'd want a 'no hex' flag to suppress the hex. > > > > Probably more useful flags are ones to suppress the address column. > > This is already supported by the prefix_type parameter - are you proposing > that we eliminat

RE: [PATCH 1/4] lib/hexdump.c: Allow 64 bytes per line

2019-04-15 Thread David Laight
From: Alastair D'Silva > Sent: 15 April 2019 11:29 ... > I do, and I believe the choice of the output length should be in the hands > of the caller. > > On further thought, it would make more sense to remove the hardcoded list of > sizes and just enforce a power of 2. The function shouldn't dictat

RE: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

2019-04-15 Thread David Laight
From: Alastair D'Silva > Sent: 15 April 2019 11:07 ... > In the above example the author only wants the hex output, while in other > situations, both hex & ASCII output is desirable. If you just want ASCII > output, the caller should just use a printk or one of it's wrappers. Hexdump will 'sanitis

RE: [PATCH 4/4] lib/hexdump.c: Allow multiple groups to be separated by lines '|'

2019-04-10 Thread David Laight
From: Alastair D'Silva > Sent: 10 April 2019 04:17 > With the wider display format, it can become hard to identify how many > bytes into the line you are looking at. > > The patch adds new flags to hex_dump_to_buffer() and print_hex_dump() to > print vertical lines to separate every N groups of by

RE: [PATCH V2 5/5] Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1

2018-10-18 Thread David Laight
From: Dan Carpenter > Sent: 18 October 2018 07:33 > > On Thu, Oct 18, 2018 at 05:09:32AM +, k...@linuxonhyperv.com wrote: > > From: Dexuan Cui > > > > The patch fixes: > > > > hv_kvp_daemon.c: In function 'kvp_set_ip_info': > > hv_kvp_daemon.c:1305:2: note: 'snprintf' output between 41 and 41

RE: [PATCH v5 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set array

2018-08-30 Thread David Laight
From: Miguel Ojeda > Sent: 30 August 2018 12:11 ... > > + unsigned long value_bitmap[1]; /* for DATA[0-7], RS, RW */ > > (I read your comments in the other email) > > I still find this odd, but if everyone is going to have this change > done like this, consistency is better. Maybe there o

RE: [PATCH 1/2] staging: rtl8192e: Fix compiler warning about strncpy

2018-08-21 Thread David Laight
From: Larry Finger > Sent: 20 August 2018 18:51 > When strncpy() is called with source and destination strings the same > length, gcc 8 warns that there may be an unterminated string. Using > strlcpy() rather than strncpy() forces a null at the end and quiets the > warning. > > Signed-off-by: Larr

RE: [PATCH] staging: lustre: add error handling for try_module_get

2018-06-13 Thread David Laight
From: Zhouyang Jia > Sent: 12 June 2018 05:49 > > When try_module_get fails, the lack of error-handling code may > cause unexpected results. > > This patch adds error-handling code after calling try_module_get. ... > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > @@ -2422,7 +2422,10

RE: [PATCH 1/4] staging: lustre: obdclass: change spinlock of key to rwlock

2018-05-03 Thread David Laight
From: James Simmons > Sent: 02 May 2018 19:22 > From: Li Xi > > Most of the time, keys are never changed. So rwlock might be > better for the concurrency of key read. OTOH unless there is contention on the spin lock during reads the additional cost of a rwlock (probably double that of a spinlock

RE: [PATCH] staging: fsl-dpaa2: replace simple switch case by if statement

2018-03-21 Thread David Laight
From: > hariprasath.ela...@gmail.com > Sent: 21 March 2018 11:16 > From: HariPrasath Elango > > Replace a couple of simple switch cases by if condition Why? In principle extra 'case' might be needed in the future. ... > diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c > b/driver

RE: [PATCH] Staging: nvec: fix line should not end with a open parenthesis.

2018-02-16 Thread David Laight
From: Yash Omer > Sent: 16 February 2018 11:37 > This patch fix line should not end with open parenthesis found by > checkpatch.plscript. > > Signed-off-by: Yash Omer > --- > drivers/staging/nvec/nvec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/stagin

RE: [PATCH 16/22] xen-blkfront: Make use of the new sg_map helper function

2017-04-18 Thread David Laight
From: Logan Gunthorpe > Sent: 13 April 2017 23:05 > Straightforward conversion to the new helper, except due to > the lack of error path, we have to warn if unmapable memory > is ever present in the sgl. > > Signed-off-by: Logan Gunthorpe > --- > drivers/block/xen-blkfront.c | 33 +++

RE: [PATCH 5/7] staging: r8712u: Fix Sparse endian warning in rtl871x_recv.c

2017-02-13 Thread David Laight
From: Larry Finger > Sent: 11 February 2017 03:30 > Sparse reports the following: > CHECK drivers/staging/rtl8712/rtl871x_recv.c > drivers/staging/rtl8712/rtl871x_recv.c:657:21: warning: incorrect type in > assignment (different base > types) > drivers/staging/rtl8712/rtl871x_recv.c:657:21:

RE: [PATCH 6/7] staging: r8712u: Fix Sparse warnings in rtl871x_ioctl_linux.c

2017-02-13 Thread David Laight
From: Larry Finger > Sent: 11 February 2017 03:30 > Sparse reports the following: > CHECK drivers/staging/rtl8712/rtl871x_ioctl_linux.c > drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1422:46: warning: restricted > __le16 degrades to integer > drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1424

RE: [PATCH 1/7] staging: rtl8712: Fix some Sparse endian messages

2017-02-13 Thread David Laight
From: Larry Finger > Sent: 11 February 2017 03:30 > Sparse reports the following: > > CHECK drivers/staging/rtl8712/rtl8712_xmit.c > drivers/staging/rtl8712/rtl8712_xmit.c:564:42: warning: cast from restricted > __le32 ... I think you ought to do separate patches for the changes that are onl

RE: [PATCH v5 02/46] usb: gadget: add endpoint capabilities flags

2015-07-31 Thread David Laight
From: Robert Baldyga > Sent: 31 July 2015 15:00 > Introduce struct usb_ep_caps which contains information about capabilities > of usb endpoints - supported transfer types and directions. This structure > should be filled by UDC driver for each of its endpoints, and will be > used in epautoconf in n

RE: [PATCH 4/8] staging: et131x: Use for loop to initialise contiguous macstat registers to zero

2014-08-21 Thread David Laight
From: Mark Einon > Replace a long list of contiguous writel() calls with a for loop iterating > over the same address values. > > Also remove redundant comments on the macstat registers, the variable names > are good enough. ... > - writel(0, &macstat->txrx_0_64_byte_frames); ... > - write

RE: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

2014-06-09 Thread David Laight
From: Of Andrzej Hajda ... > > You can't error out on module unload, although that's not really relevant > > here. gpiochip_remove() is typically called when the device that registered > > the GPIO chip is unbound. And despite some remove() callbacks having a > > return type of int you can not abor

RE: [PATCH] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread David Laight
From: Behalf Of Ken Helias > All other add functions for lists have the new item as first argument and the > position where it is added as second argument. This was changed for no good > reason in this function and makes using it unnecessary confusing. > > Also the naming of the arguments in hlist

RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit

2014-06-04 Thread David Laight
From: Julia Lawall > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote: > > > Hi Julia, > > > > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall wrote: > > > OK, thanks. I was only looking at the C code. > > > > > > But the C code contains a loop that is followed by: > > > > > > if (!size) > > >

RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit

2014-06-04 Thread David Laight
From: Julia Lawall > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote: > > > Hi Julia, > > > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall wrote: > > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may > > > return a larger number than the maximum position argument if that po

RE: [PATCH 2/3] staging: r8188eu: Fix case where ethtype was never obtained and always be checked against 0

2014-04-10 Thread David Laight
From: Dan Carpenter ... > > - if (auth_alg == 2) { > > + if (auth_alg == dot11AuthAlgrthm_8021X) { > > + /* get ether_type */ > > + ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE; > > + memcpy(ðer_type, ptr, 2); > > + ether_type = ntohs((unsigned shor

RE: [PATCH] staging: octeon-usb: prevent memory corruption

2014-03-20 Thread David Laight
From: Aaro Koskinen > octeon-hcd will crash the kernel when SLOB is used. This usually happens > after the 18-byte control transfer when a device descriptor is read. > The DMA engine is always transfering full 32-bit words and if the > transfer is shorter, some random garbage appears after the buff

RE: [PATCH] drivers: staging: lustre: lustre: include: add "__attribute__((packed))" for the related union

2014-02-03 Thread David Laight
From: James Hogan > On 03/02/14 10:35, David Laight wrote: > > From: James Hogan > >> Combining __packed with __aligned(2) does the trick though (__packed > >> alone sets __aligned(1) which is obviously going to be suboptimal). ... > > Meta is also one of those

RE: [PATCH] drivers: staging: lustre: lustre: include: add "__attribute__((packed))" for the related union

2014-02-03 Thread David Laight
From: James Hogan > On 03/02/14 10:05, David Laight wrote: > > From: Dan Carpenter > >> On Sat, Feb 01, 2014 at 09:57:39PM +0800, Chen Gang wrote: > >>> It seems, our kernel still stick to treate 'pack' region have effect > >>> with both &

RE: [PATCH] drivers: staging: lustre: lustre: include: add "__attribute__((packed))" for the related union

2014-02-03 Thread David Laight
From: Dan Carpenter > On Sat, Feb 01, 2014 at 09:57:39PM +0800, Chen Gang wrote: > > It seems, our kernel still stick to treate 'pack' region have effect > > with both 'align' and 'sizeof'. > > It's not about packed regions. It's about unions. It's saying the > sizeof() a union is a multiple of

RE: [RFC PATCH] vsnprintf: Remove use of %n and convert existing uses

2013-09-12 Thread David Laight
> On Wed, Sep 11, 2013 at 05:04:17PM -0700, Joe Perches wrote: > > On Thu, 2013-09-12 at 08:40 +0900, Tetsuo Handa wrote: > > > Joe Perches wrote: > > > > - seq_printf(m, "%s%d%n", con->name, con->index, &len); > > > > + len = seq_printf(m, "%s%d", con->name, con->index); > > > > > > Is