From nobody Wed Apr 1 11:09:47 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 CB37E36E486 for ; Mon, 30 Mar 2026 18:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774894982; cv=none; b=ak7gI9awRtKQO/gFCIOx+e6dAB0bthAcv4KHOleH2R1qdbpHwDAXFYdCXvqz0B/HX9Wfi+9b9yZFaUzz50IzypP4QAjq4UQLk9RMzzsEVmFIEbPmI9TVjYqIxPenOVyWTU+8GJLnCpS3Vmhie5FHPBV4k46ZoZpvCnEQqnYYoWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774894982; c=relaxed/simple; bh=nQfxStQgAZIT/7V2Dz+B5yYQNdnSX6jeRQJEbF127hc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YfBUPwOUUG14IsXL5PW5blvIKS61bN7ndnBOrzUyQ2y228ME+P4Zz9SxPScTDY+ivOXol3WdB6KlR9RAX6hGar3e4jKPbhIEKaaB/w0T6UAtd+z2KSOZ+vX8xqpRMZmGKcT6WYh1b6w7qblgRte7tXuyyJvXT8keFGIwt9ZeYl4= 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=l62M9c8W; arc=none smtp.client-ip=209.85.128.49 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="l62M9c8W" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-48540d21f7dso58024305e9.0 for ; Mon, 30 Mar 2026 11:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774894979; x=1775499779; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/YYKbi9TAQDo4vIdQzi1VMjiLJLyck2kBAU63KbgZ0A=; b=l62M9c8W2YcbBml79s0nDm4CDkRnyKD+O0dpvV+0GQrAdxBJCmLraxfusAW1hpXhPI Bx7WguD2mXLByPn9KNJgW8r2QgpAEkZncLbUaQIAcJEo9G/WJc0oKAcXffVx434bZ/vp Yz2nIwsnpF6WKzotbqLOKBrO4Rh9MPM9keQ+GkQR2+0Ojan0xSN6W6glzYH2QV/dylfW MvCFEQKxK0OTZRYMggjA6AI5k+Tw7bM8EkSBlPqrBGlhKqvyPLZ+YBCUI9X10TxwD19q ttLmgJtC94y4ulzbY15fHSQkYWeCYEFcsCSyLmJ5h0FIupRVbPFAr3I5BIFnbAuDfndU Olzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774894979; x=1775499779; h=content-transfer-encoding:mime-version: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; bh=/YYKbi9TAQDo4vIdQzi1VMjiLJLyck2kBAU63KbgZ0A=; b=Gd3NVE7COygDfZMGKP+d/9vCyhcr21CqUCjzWZzIUOQrY1EiYdN5cAdD8YgI4PIa0p M6W5f3QsKsBeqcY3euaA+b5VRU5+QrRjyZWTvS4WswCZkvng4R7ofM0ltYdtWZfpr//u rHlgosTdiCj2g0fEhH2OrCl8NU6RGFUOydpF+MW4X0/564CKdME7mHDP98zAtHN/4Y5X xt0hZVakrKoJzL5PRtrUWdNoTklLw7K4K5aaxztXVTh6jjbAtYU0cqO3LJomwRtLl3vY pr+R0iHg3q769g5kFcEhEsr55396R9HEsophVyX/eDan4aM2m7s5evMwDL3RNFQ256RT mx2g== X-Forwarded-Encrypted: i=1; AJvYcCU3QMNm/OiZIKGN9W6YECikYFF3hFoEtCap8FK6mtqGWv71tRxNATfxuD+dmBIC23D9+WN8BLlB1hwFBX0=@vger.kernel.org X-Gm-Message-State: AOJu0YxdGbCuGghKnL9/es+yBNBGLxm79AWUucEZ+2HvDkkl8IqdCU+h LX1U/d9poo6qC8d8iNMiFUZN4N+xTDPs5m7Oz3Klo8iW74N5LGhcYThW X-Gm-Gg: ATEYQzwiSy51tLGPyKhpTvzBzlFXmtRiGYFK1TOVsIrQU/Y/ETu0sUEpr1FVcJLJVN/ sdmc0jJ+U2oSVb0x8BJhhwb73c/Q3+phxyD50j45x+QUdjYekB+Ic5XUA1FdizJt810WWqMBHHW exFsnTXuKxVowS8Et76mi9jOwPIvZAE1rTUMiW8KYN4Uc1bW68XrWCG8qeWjZ2ieYTAMORkLBNa CFjDGufh2QUUwX/hNAT5JBkWdGr3r1KN1U3OZeCv1vbzt7M8KuNodmIbI7wJBxSmq0aQ6bR5Qt9 BvxlpzPFTnBL/W4jPYEvB+b3IRA/HawjU4yPoSiHeHHr3jmKyIAq3wdEyXNlxx2Qu/+aS2/lsde ESIqSZ9PEce3GVHw6+ghWnUVq6uUep6zKJ7HP8BMquR7S+WGQ2LIBcbjpf1fDjnNqZUll11Hp0U xbFvSa9UyeSlBU2FtETe9Qmz2xPyQZmm96H2KjDGblUb5FhShwz0vt X-Received: by 2002:a05:600c:4e15:b0:485:2ce2:4c8a with SMTP id 5b1f17b1804b1-48727d67a21mr218116275e9.1.1774894979039; Mon, 30 Mar 2026 11:22:59 -0700 (PDT) Received: from localhost.localdomain ([2001:8a0:6c9b:a000:3437:41ca:45cc:e6f1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48733c095dbsm130198405e9.0.2026.03.30.11.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 11:22:58 -0700 (PDT) From: grondon@gmail.com To: parthiban.veerasooran@microchip.com, christian.gromm@microchip.com, gregkh@linuxfoundation.org Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Gabriel Rondon Subject: [PATCH v2 1/5] staging: most: dim2: replace BUG_ON() in try_start_dim_transfer() Date: Mon, 30 Mar 2026 19:22:51 +0100 Message-Id: <20260330182255.75241-2-grondon@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260330182255.75241-1-grondon@gmail.com> References: <20260330182255.75241-1-grondon@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gabriel Rondon Replace BUG_ON() calls with graceful error handling. For the null/uninitialized channel checks, return -EINVAL instead of crashing the kernel. For the zero bus_address check, release the spinlock and return -EFAULT. BUG_ON() is deprecated as it crashes the entire kernel on assertion failure (see Documentation/process/deprecated.rst). Signed-off-by: Gabriel Rondon --- drivers/staging/most/dim2/dim2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/d= im2.c index 66617e89e..48315f8cd 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -165,8 +165,8 @@ static int try_start_dim_transfer(struct hdm_channel *h= dm_ch) unsigned long flags; struct dim_ch_state st; =20 - BUG_ON(!hdm_ch); - BUG_ON(!hdm_ch->is_initialized); + if (!hdm_ch || !hdm_ch->is_initialized) + return -EINVAL; =20 spin_lock_irqsave(&dim_lock, flags); if (list_empty(head)) { @@ -187,7 +187,10 @@ static int try_start_dim_transfer(struct hdm_channel *= hdm_ch) return -EAGAIN; } =20 - BUG_ON(mbo->bus_address =3D=3D 0); + if (mbo->bus_address =3D=3D 0) { + spin_unlock_irqrestore(&dim_lock, flags); + return -EFAULT; + } if (!dim_enqueue_buffer(&hdm_ch->ch, mbo->bus_address, buf_size)) { list_del(head->next); spin_unlock_irqrestore(&dim_lock, flags); --=20 2.33.0