Watchdog reset while changing CLock frequency

I have configured my stm32f427 microcontroller, Sysclk to run in a clock frequency of 60mhz(HSI and PLL). I have reduced it to 16mhz (Sysclk directly from HSI). While executing this code watchdog resets. Below mentioned the code I have used to change the clock frequency. RCC_HSICmd(ENABLE);while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);

Wouldn't the obvious solution be to kick the watchdog in the while(1) loop?

Ask yourself how long the watchdog period is.
Ask yourself how long the HSI takes to start, check the specs, and verify in real life.
Consider if you need a timeout in the loop so it's not stuck in an infinite loop

You didn't specify IWDG or WWDG watchdog, or what the timer periods are. For the IWDG, reset it periodically in the while loop, although an HSI startup should be short enough you can just hit the IDWG before switching frequency.

For the WWDG you need to wait until the window is long enough to complete the frequency change. Just before or while in the HSI ready loop poll the WWDG counter and hit it once while it is inside the reset window.

Do you know which watchdog caused the reset? The WWDG has an early warning interrupt you can use to make sure it won't time out; you can also reset the IWDG at the same time. Not the best practice (the watchdogs should be independently reset at two different points) but it will get you running.
Jack Peacock