From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 88A773C199B for ; Wed, 5 Aug 2026 09:35:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785922542; cv=none; b=miA5G/aw5ok0IB3BxyVJJ9KAf5H57k+svrOZF9zi/dnLisDpzuDZ60QucGv6/OZyo8h/g/F/FBvcTK4PG3iCVN/JqJ1fXvwfytU9hklDSj1YZYBMzgTqEShH6wy8r+UWVIxirjqm6r8Y3z+LBet5dPt950g2nXBjqxO3YclQO8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785922542; c=relaxed/simple; bh=MBuvpf6oL2H35T8IOFnl1sALl1OaDA5Qn3v17eTpqnU=; h=From:To:Cc:Subject:Date:Message-Id; b=kRUaxfJI7mA8iz+CPBrQcv4yOtw4BST0vOUtCVgD9gTqLOKX6JYN3p0jBIk+ErZ/S6/Pj0rkm+F+LbjdmdEA8ADO3RMvQM64dGr3GqegdHN71PjRmVtmflcqxbX+k0g/QVgRhIBWSQJjYrBAiFmBX+J+QIdgDGR+3jKk8X73aoI= 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=f6y+c2OF; arc=none smtp.client-ip=209.85.208.54 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="f6y+c2OF" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-6a0794669a6so807903a12.2 for ; Wed, 05 Aug 2026 02:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785922539; x=1786527339; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=yFBvBKl/OqSvTd6Ik0WxL1HYL9cSwEY6tnyQJfkmT1g=; b=f6y+c2OFZRds64fv0DjKmXKiYJeLdNVXjV+gKZLxEnH3rIHKk4ukdCRvmV3UTVB8ZM EhRFtEt6GHToTug45L+e8oNxqFcFujyntyfYlPT8pc48N14q0lSo2f7JVtsLxLdayPO7 MCGKysg5e2dMKBXvy9bb8oJToqE77S5BY6fjVg0hL3zyhPcO/w6PH/WBpUUyM2DmJbG5 wX8bZa0Jv/uxQqd3vERv1aRkW+lx/auXxdkpafM0pSHQP4XXNY7orM+yc5XWwSrrRCbl JsQGPMqpGpf+N8HOpJZlU2qmCBcp5MF3EzJC/wlfdaejYJ3T5x3e0W5on+H6YkgjVdKD IS7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785922539; x=1786527339; h=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=yFBvBKl/OqSvTd6Ik0WxL1HYL9cSwEY6tnyQJfkmT1g=; b=gdspQKFfK7SJ7aYQDUR70FlDMJ+aDjwu4w8mxfylH92BOXlttYXiQAigM1iX7nBJ0k HOyK5Wx5U2t3GX/We+udx1c6aS168lnADNYjyfc/JRI3Aa9IWY/UbpopEJg+Erl08ZX2 pShwLQBWUrBkFBlH56iuVxvSQ9Lrj+n2htOtZHf9kvjwL/zXnds4T5APYi3oKWuc75Y6 HdYPTeexTE7ethGPqJxxiGrUPE1u+FKek62LBE6HB5VG2PXqnuKRKntf2C3AQHpcDM+h JU0Mj1eb51A/UeVsBtjXN26zKp1PL8olkiRU43vL1BGDyZf3G3iDRRmPQnaRd/JRggEl nJzA== X-Forwarded-Encrypted: i=1; AHgh+Rr8EpspnXiMp+4ek7ktO4rhrNVCQ4ZEYuNT375dHHmAlV/Lg3ug548EMmRDjYlLCbK67PkjQ8iKBywTI34=@vger.kernel.org X-Gm-Message-State: AOJu0YwwI8/Oondlx1OgpgcqaRn1wBLJy/QIH20vJvvTjyhfDo5AHNww Iqidmaf5BmhaK2rsAaYP1eOcCcHN1N3wy/JxgkKAVUbA3MArQMRh+6xD X-Gm-Gg: AR+sD12es1LpRzsi+SRbh0cYwivE9XtQJ0q2nPay5ZweGBklwWj1hjuWtB5F6phsfGR p+JAXNE4w7yVefif7lDL4eb+5qXUStESl9lkajmgVpyKW8qpoqxYNgDAvM3/RUxVeQntzsBUiNy 1OlUdaBo/BtOEdProcLVdjuBo1d518sR9M8PxlUeUf+L7UNeFXzpriP68AqpNRi2h+2xlv4Tpr+ MsaxDxQQSPO8V1RkU5BRgwU3aeHDIi75Peom6a+25w/DznR7HYXWQI7UzeiItI5Clnsuq6pTaIE BV+HfnEssODwjrPAZDs6PSSFKkOTQ5fcZCot1Bhyx+F9H9lOxxg+Ac9U14tpBJ75FVprF1iI4pn 0c164SZLNl8Jh4ollZ9KuEoRKRNlY6l9TsbrV1qdH652X61rPWoK9ClH+7Adq8sSPLackMekYvx jmyH4xdqN/zMk4/yeLO5nRvqeZ9BhrtGkt6hYzf1Sn3S+UfhmBTJS2LrYLHzd6+0EP+viqiuDCq Yvp1sLdUf5KLjh5 X-Received: by 2002:a05:6402:42c8:b0:69c:6547:518b with SMTP id 4fb4d7f45d1cf-6a14f1395edmr2611804a12.12.1785922538675; Wed, 05 Aug 2026 02:35:38 -0700 (PDT) Received: from localhost (c-85-228-45-68.bbcust.telenor.se. [85.228.45.68]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a145c2813esm1597512a12.6.2026.08.05.02.35.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Aug 2026 02:35:38 -0700 (PDT) From: Eli Billauer To: gregkh@linuxfoundation.org Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, corbet@lwn.net, Eli Billauer Subject: [PATCH v4 0/7] char: xillybus: Harden driver and improve code quality Date: Wed, 5 Aug 2026 11:34:29 +0200 Message-Id: <20260805093436.59740-1-eli.billauer@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This patch set consists of several boundary and sanity checks, gaining better control of execution flow and fixing minor coding issues. No difference is expected in the driver's behavior under normal conditions, except for one change that might improve bandwidth performance marginally. Why all of the sudden? These patches are the result of a comprehensive AI-assisted code review, using Deepseek, Kimi Thinking K2.6, ChatGPT, and Claude Sonnet 4.6 as plain prompt tools. I've spent three weeks in what I call a "reverse rubber duck" session, asking these LLMs to find bugs in the code and following up on different leads, the vast majority of which turned out to be no more than quack. Occasionally the points made by AI were valid, and in others, the mere effort to explain why the remark is wrong to the rubber duck led to finding real issues. Almost none of the fixes suggested by AI were even near the actual corrections in this patch set. The v1 iteration of this series was rejected due to an error in the error path. Specifically, the @rc variable was not assigned a value before a goto statement following a failed allocation. This oversight was caught during compilation with LLVM=1, but was missed by GCC and the AI tools used during the review (and myself of course). All patches are unchanged since v1, except for "Add defensive sanity checks", which fixes the said error and also makes a couple of minor adjustments. The change from v2 to v3 merely consists of adding Assisted-by tags to the patches as required. This v4 submission is the response to some of Sashiko's remarks on the v3 submission: https://sashiko.dev/#/patchset/20260724094302.50761-1-eli.billauer@gmail.com Three remarks relate to the patches in these patch set, and have been corrected accordingly, with Assisted-by tags duly added. Sashiko also had several other valid remarks which call for additional patches. These will be submitted once the processing of this patch set is done. Thanks & regards, Eli Eli Billauer (7): char: xillybus: Improve control of execution flow with mutexes char: xillybus: Remove duplicate error path code char: xillybus: Avoid possible bandwidth inefficiency char: xillybus: Use unsigned arithmetic for jiffies differences char: xillybus: Integer arithmetic improvements char: xillybus: Add defensive sanity checks char: xillybus: Ignore and report unsolicited interrupts drivers/char/xillybus/xillybus.h | 3 + drivers/char/xillybus/xillybus_class.c | 18 ++++- drivers/char/xillybus/xillybus_class.h | 3 + drivers/char/xillybus/xillybus_core.c | 95 +++++++++++++++++++++++--- drivers/char/xillybus/xillybus_of.c | 3 + drivers/char/xillybus/xillyusb.c | 65 +++++++++++++----- 6 files changed, 158 insertions(+), 29 deletions(-) -- 2.34.1