Messages in this thread Patch in this message | | | From | Gautam Menghani <> | Subject | [PATCH] drivers/char/agp: Fix divide by zero warning in isoch.c | Date | Sat, 21 May 2022 00:38:48 -0700 |
| |
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
| |