From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43DBC4C8FEF for ; Wed, 22 Jul 2026 10:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784715845; cv=none; b=jyhD9fzvmURc5BAj6dS4xBRJ/lEeGZQ2K51aWWPEhTAl9Wx27oI3QmRako61Qb/WbKPlma2t0o5ChOTyyTrMaQEUVfE6/8bXpL+WZduQFUFVdUjqlONwAZUH054a+MrVf2odVFne0Bp82K5vaIzHmTdMthKzf+sKPI0TA8AX9rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784715845; c=relaxed/simple; bh=xcSwUOWwbHN68RSMdIrAWHC+mmFpQlBkZfYm1XY0SRE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=VuuGQSTcTtWltEtC+s+Ifecd/AvCFfV4+kK2z1Cq+PfrHz/8fbUzLuxXfxNbx89N0KF/Uc2Gy4IXY1ucqtX8gCVmIzhuAa6Qc8ZlcPjfH1zB8aG7sumZ4xf8Pw7cAeiOgRB0FWzew05KadWSfn6WAzk1GMEU7kuWDva2nu5NXr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ftEFiz1Y; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ftEFiz1Y" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-698ae09e356so16905982a12.2 for ; Wed, 22 Jul 2026 03:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784715842; x=1785320642; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=n+preuA+nMVyBQobrPRWiLJ/mQb+BZ/kyfSM4bj8ukI=; b=ftEFiz1YTpe7kPygeLyj+2vE73LfoltknG2ANDL9PUGYB0a+METk5jP2u5BiH17AC4 kaSR5wzUgogi7ZHNQHpw7DMUTy7A/MIKf6vWQsqvBYNac7fBJl7pBQPuX9I/Ck9KnTPG EbtTcIUunL2cJv0RzpVKtpwLLKOZS0AGI/q16axXP5OtpWAq9WYBSLGIuBzCG/1x/Mtj JEV2P24OI5h0++MgtCu+1CeJsNZvBqSRsmuzJUoCFaQgs0OWst9wmzFyMW5qzVveI077 tUbCgKVW9BtK4sCyyDvBZnjNk45fKpybFPk8kQ1rl2bH1J0zP0kPk5MauVqUtmU4oL0u JfAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784715842; x=1785320642; h=references:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=n+preuA+nMVyBQobrPRWiLJ/mQb+BZ/kyfSM4bj8ukI=; b=RKFaUtDZPQYSlXxd7l+KaSv6xP/aV4SjDf+q3OYaj8RcvMOaULe2KhnWHu/P/XEsgp cXBxlJwmW2ppbcRBtRFZEgoQNAnos0StXLW1BBFhUXBs5rxC3kEfWxld81AEUKr166s8 a3UgutxJv2U5OUibuNCN/GVYbY58swD/xbU453rGbgp2CUmkQNnWLi4WRFZinyzH4IVB TsNyTE77Q2IwbwAeLqrIy13RO6RNLxZ+QFONeHmaoNB+C5jYUV2HXlXitkPxYWH27P1u M6x5MNKYmflVDqSORQHjog3Pm6OPaqfcVLVwSeRBlm075cLJe8JtGLGFxB4awkRxSdu4 fs6g== X-Forwarded-Encrypted: i=1; AHgh+RoX0QhW/yYuvOBZRP6k5LJDO2E++SfbRukZVoKZL29b+pco0FVPrnucbBIYipAEA8w+PJJDqGeXFMU2ByQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1AI3KKdC9fZWXw1s1U28EV3DkqI43cnewBqubHZxBoWeNNDra 42VxdMZ8yod3Ce7me6wXWH2sUFvXgd6qhdW2SAMSSM/UnHDyuC0CVcH2 X-Gm-Gg: AR+sD11iW7ZQJwSN0pI23RINn8HTx2ncNaRQhD8WzCEURG2ep30FIGF1iFQIYAvllLm Rua2H4Bbt/zNxcVdw1l2ZQalgMZtwfmIz938KDIXz4vm+dhR1JzWH7ymQnGvS9NO9AcYPaI5Puj xsUwEBAhoqck1h9d6juNrlXQEiIbgC5o+82rT0a93cG3f4oZJgBQn/qBKHPs4X9H7O8RS1iWzeK SStVbqPOMpfx0kNaR3HUVLbpiN6pnHLj/gdbtoxLA62hEM/l7bluQl3KVCaiEmMbiGy03Ibfyrd 5Zeae62E5GmW+14g8ivR9YcmflrqQBZg9gaYGk6Q/w+yZxFlcTCpqAhe2zQZECcJfk0iH4YN5DG U0FRWdI+UUgO55xWaMvnVtQP0x9cJmOpvC2OrwQx9fDVxl9+PJRg5olNQWTPu+tqgjPG3Cw1xOo Ugh+0ZqHNyNiy/L0d8G5cQarlCBBYrqg== X-Received: by 2002:a17:907:a0d6:b0:c1c:2218:f316 with SMTP id a640c23a62f3a-c1c22190b90mr274000366b.59.1784715842361; Wed, 22 Jul 2026 03:24:02 -0700 (PDT) Received: from localhost (c-85-228-45-68.bbcust.telenor.se. [85.228.45.68]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c1c32ac6ff3sm83628366b.19.2026.07.22.03.24.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Jul 2026 03:24:01 -0700 (PDT) From: Eli Billauer To: gregkh@linuxfoundation.org Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, Eli Billauer Subject: [PATCH v2 5/7] char: xillybus: Integer arithmetic improvements Date: Wed, 22 Jul 2026 12:23:05 +0200 Message-Id: <20260722102307.49090-6-eli.billauer@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260722102307.49090-1-eli.billauer@gmail.com> References: <20260722102307.49090-1-eli.billauer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Choose unsigned integers instead of signed where natural, and also ensure overflow wraps as expected. Simplify an arithmetic expression too. No functional change is expected, as the relevant variables normally never reach values where this transition matters. Signed-off-by: Eli Billauer --- Notes: No change on v1->v2. drivers/char/xillybus/xillybus_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c index 7acebc1e6050..b264578b2572 100644 --- a/drivers/char/xillybus/xillybus_core.c +++ b/drivers/char/xillybus/xillybus_core.c @@ -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; @@ -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; -- 2.34.1