X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fnbsd-libpci.c;h=0b247c0e10a0ee5b98bdfd14d5d3fd75b7c307be;hb=239ff18adf556b63a16be968725ba9fd0e6d5227;hp=e1bebd7d60a056485b4d99e2ec20d19c33ff315d;hpb=130090bd661f7c575d6751800daacabcb0a0baf3;p=pciutils.git diff --git a/lib/nbsd-libpci.c b/lib/nbsd-libpci.c index e1bebd7..0b247c0 100644 --- a/lib/nbsd-libpci.c +++ b/lib/nbsd-libpci.c @@ -104,7 +104,7 @@ nbsd_write(struct pci_dev *d, int pos, byte *buf, int len) */ shift = 8*(pos % 4); - pos &= 3; + pos &= ~3; if (len != 4) { if (pcibus_conf_read(d->access->fd, d->bus, d->dev, d->func, pos, &val) < 0) @@ -114,10 +114,10 @@ nbsd_write(struct pci_dev *d, int pos, byte *buf, int len) switch (len) { case 1: - val = (val & ~(0xff << shift)) | buf[0]; + val = (val & ~(0xff << shift)) | (buf[0] << shift); break; case 2: - val = (val & ~(0xffff << shift)) | le16_to_cpu(*(u16*)buf); + val = (val & ~(0xffff << shift)) | (le16_to_cpu(*(u16*)buf) << shift); break; case 4: val = le32_to_cpu(*(u32*)buf);