This check seems to be redundant. If we enter the loop with len=0 no iterations will be done and we will end up doing free(crtc_info_r).