]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/aix-device.c
Squashed compiler warnings about code with no effect
[pciutils.git] / lib / aix-device.c
index 55b2f306dd80ae0a0d492d0bed2fb37449b856c1..e02c98dc4cd647597d0dfe20c760b4ea1c40e385 100644 (file)
@@ -207,7 +207,7 @@ aix_scan(struct pci_access *a)
   int bus_number;
   byte busmap[256];
 
-  bzero(busmap, sizeof(busmap));
+  memset(busmap, 0, sizeof(busmap));
   for (i = 0; i < pci_bus_count; i++)
     {
       bus_number = pci_buses[i].bus_number;
@@ -222,8 +222,12 @@ static int
 aix_read(struct pci_dev *d, int pos, byte *buf, int len)
 {
   struct mdio mdio;
-  int fd = aix_bus_open(d->access, d->bus);
+  int fd;
 
+  if (pos + len > 256)
+    return 0;
+
+  fd = aix_bus_open(d->access, d->bus);
   mdio.md_addr = (ulong) pos;
   mdio.md_size = len;
   mdio.md_incr = MV_BYTE;
@@ -232,7 +236,7 @@ aix_read(struct pci_dev *d, int pos, byte *buf, int len)
 
   if (ioctl(fd, MIOPCFGET, &mdio) < 0)
     d->access->error("aix_read: ioctl(MIOPCFGET) failed");
-  
+
   return 1;
 }
 
@@ -240,8 +244,12 @@ static int
 aix_write(struct pci_dev *d, int pos, byte *buf, int len)
 {
   struct mdio mdio;
-  int fd = aix_bus_open(d->access, d->bus);
+  int fd;
+
+  if (pos + len > 256)
+    return 0;
 
+  fd = aix_bus_open(d->access, d->bus);
   mdio.md_addr = (ulong) pos;
   mdio.md_size = len;
   mdio.md_incr = MV_BYTE;