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

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 26 Jul 2011 20:27:39 +0200 (CEST)

Author: kallisti5
Date: 2011-07-26 20:27:39 +0200 (Tue, 26 Jul 2011)
New Revision: 42499
Changeset: https://dev.haiku-os.org/changeset/42499

Modified:
   
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp
   
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp
Log:
* Fix improper sizeof, CID 10628
* Improve malloc check to look for NULL, CID 10698
* Remove unused size_t


Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp
 2011-07-26 16:42:14 UTC (rev 42498)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemDevice.cpp
 2011-07-26 18:27:39 UTC (rev 42499)
@@ -270,15 +270,15 @@
        if (fNotifyWriteSem >= B_OK)
                delete_sem(fNotifyWriteSem);
 
-       if (fNotifyBuffer)
+       if (fNotifyBuffer != NULL)
                free(fNotifyBuffer);
                        // Free notification buffer
 
-       if (pwmxdevice->nvmFlashCSInfo)
+       if (pwmxdevice->nvmFlashCSInfo != NULL)
                free(pwmxdevice->nvmFlashCSInfo);
                        // Free flash configuration structure
 
-       if (pwmxdevice)
+       if (pwmxdevice != NULL)
                free(pwmxdevice);
                        // Free malloc of wimax device struct
 
@@ -1017,7 +1017,7 @@
 
        unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER);
 
-       if (!buffer) {
+       if (buffer == NULL) {
                TRACE_ALWAYS("Error: Memory allocation error.\n");
                return B_ERROR;
        }
@@ -1119,8 +1119,6 @@
                return fh;
        }
 
-       size_t file_size = cfgStat.st_size;
-
        TRACE_ALWAYS("Info: Vendor configuration to be pushed to 0x%x on 
device.\n",
                loc);
 

Modified: 
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp
    2011-07-26 16:42:14 UTC (rev 42498)
+++ 
haiku/trunk/src/add-ons/kernel/drivers/network/wimax/usb_beceemwmx/BeceemNVM.cpp
    2011-07-26 18:27:39 UTC (rev 42499)
@@ -501,7 +501,7 @@
        if (pwmxdevice->driverHalt == true)
                return -ENODEV;
 
-       if (size > sizeof(&buffer))
+       if (size > sizeof(buffer))
                TRACE("Warning: Reading more then the buffer can handle\n");
 
        bSelectedChip = RESET_CHIP_SELECT;


Other related posts: