From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 359CA37702A for ; Thu, 4 Jun 2026 18:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780596143; cv=none; b=nnYweJCz42ZkXN5Vm2YWMqeaUDS0iJVUW+fIvCeLQEt+ePZrC7/mTqNwNDJoRIHsFzFmsLqYImS0mNze5JZwarUwp6i9uAFD3NneH7LlsbPN5ppvbBv5R38kqPFEY9jYYyT/B7uyCSefMowntmi4F4cpZAn9f3xfMIn8OL+Ict8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780596143; c=relaxed/simple; bh=roHnOO6PR5PMKjQ4Zpx9Ftl9QWQlUI8Jeetmvwdosng=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cNhfxheW0ZrrCAuNRnzsdje3R08mIcoqMaKoWCUB+xanNKiP+eau4Q79pFuB0elt2LSRNbe4jl5Pri82iW3A/tfYrMHB59XruRAmOeoUWj8SUk55hqfrhP06coYbGcFvymLjjsbCrFE9XqZ6Qjmqh/hkp8uNU5QJXGW0nt/22fE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=XK165cnR; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="XK165cnR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1780596139; bh=roHnOO6PR5PMKjQ4Zpx9Ftl9QWQlUI8Jeetmvwdosng=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XK165cnRMhMQL9W0EO+PZ0Alad3bxW4i3RwcIyWidfjrAQhqMt/hAvjLL7zTimE02 P27ahs825A0XqbrwrG8qkPJnJ+WN3Iv6g9rPxMh0m1YmLm5jvCg/hsNLzV7MM+vwgK lCkQYgiw728VIly+LdHKQjWQ4YDYFpbotYlvYHde9Tj9/NRattaBR23BUQ77Qf6+1v IHZ+NReu6ooaFlmsLn6VBEyF2R2gqIyKbDf8ml5Wa3fU8NRAmX+kQTmEQCutW772bF ZcaLMLb+7QqZMk8j4mf5XrF9dvfGZUaXx5xFdGeVac0I+qaJkcTVo+7huy4a8ODOlP OSHNPXwKGV5cQ== Received: from fedora-2.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 874B717E062B; Thu, 4 Jun 2026 20:02:18 +0200 (CEST) Date: Thu, 4 Jun 2026 20:02:15 +0200 From: Boris Brezillon To: =?UTF-8?B?QWRyacOhbg==?= Larumbe Cc: Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Faith Ekstrand , "Marty E. Plummer" , Tomeu Vizoso , Eric Anholt , Alyssa Rosenzweig , Robin Murphy , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Collabora Kernel Team , Neil Armstrong , Claude Subject: Re: [PATCH v2 2/7] drm/panfrost: Prevent division by 0 Message-ID: <20260604200215.303dbc43@fedora-2.home> In-Reply-To: <20260604-claude-fixes-v2-2-57c6bd4c1655@collabora.com> References: <20260604-claude-fixes-v2-0-57c6bd4c1655@collabora.com> <20260604-claude-fixes-v2-2-57c6bd4c1655@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 04 Jun 2026 18:35:21 +0100 Adri=C3=A1n Larumbe wrote: > When updating and debug-printing devfreq stats, in the very unlikely > offchance that total device time is less than 100 ns, clamp it to 0 to > avoid division by 0. >=20 > Reported-by: Claude > Closes: https://gitlab.freedesktop.org/panfrost/linux/-/work_items/88 > Signed-off-by: Adri=C3=A1n Larumbe > Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/dr= m/panfrost/panfrost_devfreq.c > index b51c30778811..e34de47bf43b 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -78,7 +78,8 @@ static int panfrost_devfreq_get_dev_status(struct devic= e *dev, > =20 > dev_dbg(pfdev->base.dev, "busy %lu total %lu %lu %% freq %lu MHz\n", > status->busy_time, status->total_time, > - status->busy_time / (status->total_time / 100), > + status->total_time >=3D 100 ? > + status->busy_time / (status->total_time / 100) : 0, or: status->busy_time * 100 / MAX(status->total_time, 1), > status->current_frequency / 1000 / 1000); > =20 > return 0; >=20