mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
char: xillybus: Integer arithmetic improvements
Choose unsigned integers instead of signed where natural and required to ensure defined overflow behavoir. Simplify an arithmetic expression too. No functional change is expected, as the relevant variables normally never reach values where this transition matters. Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6 Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview Signed-off-by: Eli Billauer <eli.billauer@gmail.com> Link: https://patch.msgid.link/20261009074557.19996-6-eli.billauer@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f82830f560
commit
04b47d2005
|
|
@ -343,7 +343,8 @@ static int xilly_map_single(struct xilly_endpoint *ep,
|
|||
static int xilly_get_dma_buffers(struct xilly_endpoint *ep,
|
||||
struct xilly_alloc_state *s,
|
||||
struct xilly_buffer **buffers,
|
||||
int bufnum, int bytebufsize)
|
||||
unsigned int bufnum,
|
||||
unsigned int bytebufsize)
|
||||
{
|
||||
int i, rc;
|
||||
dma_addr_t dma_addr;
|
||||
|
|
@ -431,8 +432,8 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
|
|||
struct device *dev = ep->dev;
|
||||
int i, entry, rc;
|
||||
struct xilly_channel *channel;
|
||||
int channelnum, bufnum, bufsize, format, is_writebuf;
|
||||
int bytebufsize;
|
||||
unsigned int channelnum, bufnum, bufsize, format, is_writebuf;
|
||||
unsigned int bytebufsize;
|
||||
int synchronous, allowpartial, exclusive_open, seekable;
|
||||
int supports_nonempty;
|
||||
int msg_buf_done = 0;
|
||||
|
|
@ -512,7 +513,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
|
|||
format = (chandesc[1] >> 4) & 0x03;
|
||||
allowpartial = (chandesc[1] >> 6) & 0x01;
|
||||
synchronous = (chandesc[1] >> 7) & 0x01;
|
||||
bufsize = 1 << (chandesc[2] & 0x1f);
|
||||
bufsize = 1U << (chandesc[2] & 0x1f);
|
||||
bufnum = 1 << (chandesc[3] & 0x0f);
|
||||
exclusive_open = (chandesc[2] >> 7) & 0x01;
|
||||
seekable = (chandesc[2] >> 6) & 0x01;
|
||||
|
|
@ -531,8 +532,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
|
|||
channel->log2_element_size = ((format > 2) ?
|
||||
2 : format);
|
||||
|
||||
bytebufsize = bufsize *
|
||||
(1 << channel->log2_element_size);
|
||||
bytebufsize = bufsize << channel->log2_element_size;
|
||||
|
||||
buffers = devm_kcalloc(dev, bufnum,
|
||||
sizeof(struct xilly_buffer *),
|
||||
|
|
@ -589,7 +589,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
|
|||
static int xilly_scan_idt(struct xilly_endpoint *endpoint,
|
||||
struct xilly_idt_handle *idt_handle)
|
||||
{
|
||||
int count = 0;
|
||||
unsigned int count = 0;
|
||||
unsigned char *idt = endpoint->channels[1]->wr_buffers[0]->addr;
|
||||
unsigned char *end_of_idt = idt + endpoint->idtlen - 4;
|
||||
unsigned char *scan;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user