* [PATCH] drivers/char/agp: Fix divide by zero warning in isoch.c
@ 2022-05-21 7:38 Gautam Menghani
0 siblings, 0 replies; only message in thread
From: Gautam Menghani @ 2022-05-21 7:38 UTC (permalink / raw)
To: airlied; +Cc: Gautam Menghani, linux-kernel
Add a check to ensure ndevs is not zero. This was found by clang scan
warning: Division by zero [core.DivideZero]
mrq = trq / ndevs;
Signed-off-by: Gautam Menghani <gautam.linuxkernel@gmail.com>
---
drivers/char/agp/isoch.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c
index 7ecf20a6d19c..da0d2681225b 100644
--- a/drivers/char/agp/isoch.c
+++ b/drivers/char/agp/isoch.c
@@ -289,6 +289,9 @@ static void agp_3_5_nonisochronous_node_enable(struct agp_bridge_data *bridge,
u32 trq, mrq, rem;
unsigned int cdev = 0;
+ if (ndevs == 0)
+ return;
+
pci_read_config_dword(bridge->dev, bridge->capndx+AGPSTAT, &tstatus);
trq = (tstatus >> 24) & 0xff;
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-21 7:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-21 7:38 [PATCH] drivers/char/agp: Fix divide by zero warning in isoch.c Gautam Menghani
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.