AnsweredAssumed Answered

STM32Cube_FW_F2_V1.1.0 question - bug ?

Question asked by sdt99 on Apr 22, 2014
Latest reply on May 29, 2014 by Montassar BEN ROMDHANE

uint8_t  USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
  USBH_InterfaceDescTypeDef    *pif ;
  USBH_CfgDescTypeDef          *pcfg ;
  int8_t                        if_ix = 0;
  pif = (USBH_InterfaceDescTypeDef *)0;
  pcfg = &phost->device.CfgDesc;  
  if((pif->bInterfaceClass == 0xFF) &&(pif->bInterfaceSubClass == 0xFF) && (pif->bInterfaceProtocol == 0xFF))
    return 0xFF;

    pif = &pcfg->Itf_Desc[if_ix];
Maybe I'm not understanding this, but it looks like the pointer pif is set to address 0 and then is immediately dereferenced in the if statement.  I can't see how this can possibly work.  

It looks to me like the if((pif->bInterfaceClass == 0xFF) might need to be inside the while() loop, right after pif is assigned the address of one of the interface descriptors.