#42 hd44780-rpi mmap check

driver (15)

The mmap() result checking in hd44780-rpi.c on line 124 is wrong.
mmap() returns pointer (man 2 mmap), casting it to (long) and checking for < 0 is wrong.
It's not working on my RPi. The driver cannot initialize. I would suggest to change the error checking line to:
if (!gpio_map) {

(sorry, too lazy to prepare a patch for one line change)


  • Markus Dolze

    Markus Dolze - 2013-02-13
    • assigned_to: nobody --> mmdolze
  • Markus Dolze

    Markus Dolze - 2013-02-13

    Actually I wasn't happy with this during first import, too. But I didn't look further into it. Using (!gpio_map) seems not be be correct as well. The right way should be

    if (gpio_map == MAP_FAILED)

    And that works fine here.

  • Stanislav Lechev [AngelFire]

    > if (gpio_map == MAP_FAILED)

    I agree, I should have read the man page more carefully. Thanks.

  • Markus Dolze

    Markus Dolze - 2013-02-22

    Fixed in CVS

  • Markus Dolze

    Markus Dolze - 2013-02-22
    • milestone: 102023 --> minor
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks