[haiku-commits] Re: r42499 - haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx

  • From: Alexander von Gluck <kallisti5@xxxxxxxxxxx>
  • To: <haiku-commits@xxxxxxxxxxxxx>
  • Date: Tue, 26 Jul 2011 20:52:30 -0500

On Tue, 26 Jul 2011 20:52:47 +0200, Axel Dörfler wrote:
On 26.07.2011 20:27, kallisti5@xxxxxxxxxxx wrote:
-       if (fNotifyBuffer)
+       if (fNotifyBuffer != NULL)
                free(fNotifyBuffer);
                        // Free notification buffer

Two things are wrong here: the comment makes this a multiline
statement, so {} are needed. However, the coding style also asks you
not to check for NULL before free() and delete, as that's just useless
clutter.
There are more occurrences of this in this patch alone.

Yup. sorry for missing that.
Fixed in 42504

I haven't seen the rest of this, so this might be wrong, but -EINVAL is
Linux (where error codes are positive), not Haiku -- so you'll likely
return something wrong there. Also, prefer to use >Haiku native errors
like B_BAD_VALUE in this case.

Fixed in 42504

the usb_beceemwmx driver was my first shot at driver development and my
C/C++ was *a lot* weaker when I wrote it. (as evident by the extremely
poor choice to use inheritance *everywhere* in it... I just played with
that toy until it broke)

Anyway, cleaning it up more, removing the inheritance, finishing the
networking bits are all on my todo list after finishing the radeon_hd
driver.

Thanks!
  -- Alex

Other related posts: