From ec2664e900b47a2381b5f04bf6b4e27b5af156b8 Mon Sep 17 00:00:00 2001 From: proski Date: Wed, 8 Apr 2009 22:25:50 +0000 Subject: [PATCH] Make ath_hal_eepromDetach() safer Check that AH_PRIVATE(_ah)->ah_eepromDetach is not NULL before calling it. This fixes kernel oops in case if the attach function for the chip fails before EEPROM support initialization and calls the corresponding detach function. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3991 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath_hal/ah_internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ath_hal/ah_internal.h b/ath_hal/ah_internal.h index 17358af..f876c8f 100644 --- a/ath_hal/ah_internal.h +++ b/ath_hal/ah_internal.h @@ -319,8 +319,10 @@ struct ath_hal_private { #define ath_hal_disablePCIE(_ah) \ (_ah)->ah_disablePCIE(_ah) -#define ath_hal_eepromDetach(_ah) \ - AH_PRIVATE(_ah)->ah_eepromDetach(_ah) +#define ath_hal_eepromDetach(_ah) do { \ + if (AH_PRIVATE(_ah)->ah_eepromDetach) \ + AH_PRIVATE(_ah)->ah_eepromDetach(_ah); \ +} while (0) #define ath_hal_eepromGet(_ah, _param, _val) \ AH_PRIVATE(_ah)->ah_eepromGet(_ah, _param, _val) #define ath_hal_eepromSet(_ah, _param, _val) \ -- 2.35.1