Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×

Comment: Re:Looks Neat (Score 1) 81

by robfoo (#30776196) Attached to: Augmented Reality To Help Mechanics Fix Vehicles

Also, diagnostic codes are not very useful if the problem lies in the computer that's telling you the codes.

I had a fault on my Mitsi GTO ('3000GT' in americanese), it was only running on about 4 cylinders. According to the fancy whiz bang diagnostic gizmo, one of the coil packs was faulty. Some time and much money later, it turned out the coils were fine, but the ECU was playing up. Replacing that solved the problem.

Computers lie! It was trying to misdirect attention so it didn't get replaced!

Comment: Re:One word.. (Score 5, Insightful) 683

by robfoo (#29199551) Attached to: Dirty Coding Tricks To Make a Deadline

I can't figure out if I'm the only sane one or the only crazy one. Especially given the 'pyramid' referred to - I don't see a pyramid unless it's rewritten to use nested ifs.

To me, nested ifs are much easier to read - they convey the meaning/intent of the code a lot better. As in 'if this function call works, then do this. Otherwise, just clean up and exit'

How is this so hard to understand?

geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id) {
        int ret;

        if ((ret = pci_enable_device(dev)))
                return ret;

        if (!(ret = pci_request_regions(dev, "geode-aes"))) {
                _iobase = pci_iomap(dev, 0, 0);
                if (_iobase == NULL) {
                        ret = -ENOMEM;
                }
                else {
                        spin_lock_init(&lock); /* Clear any pending activity */
                        iowrite32(AES_INTR_PENDING | AES_INTR_MASK, _iobase + AES_INTR_REG);
                        if (!(ret = crypto_register_alg(&geode_alg))) {
                                if (!(ret = crypto_register_alg(&geode_ecb_alg))) {
                                        if (!(ret = crypto_register_alg(&geode_cbc_alg))) {
                                                printk(KERN_NOTICE "geode-aes: GEODE AES engine enabled.\n");
                                                return 0;
                                        }
                                        crypto_unregister_alg(&geode_ecb_alg);
                                }
                                crypto_unregister_alg(&geode_alg);
                        }
                        pci_iounmap(dev, _iobase);
                }
                pci_release_regions(dev);
        }
        pci_disable_device(dev);

        printk(KERN_ERR "geode-aes: GEODE AES initialization failed.\n");
        return ret;
}

To err is human -- to blame it on a computer is even more so.

Working...