controller: fix build when disabling TCP (#37081)

diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp
index c0f0516..cbc29de 100644
--- a/src/controller/CHIPDeviceControllerFactory.cpp
+++ b/src/controller/CHIPDeviceControllerFactory.cpp
@@ -290,8 +290,10 @@
         //
         app::DnssdServer::Instance().SetFabricTable(stateParams.fabricTable);
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
         // Disable the TCP Server based on the TCPListenParameters setting.
         app::DnssdServer::Instance().SetTCPServerEnabled(tcpListenParams.IsServerListenEnabled());
+#endif
     }
 
     stateParams.sessionSetupPool = Platform::New<DeviceControllerSystemStateParams::SessionSetupPool>();