  Integrating the reconfigurable intelligent surface (RIS) into a cell-free
massive multiple-input multiple-output (CF-mMIMO) system is an effective
solution to achieve high system capacity with low cost and power consumption.
However, existing works of RIS-assisted systems mostly assumed perfect
hardware, while the impact of hardware impairments (HWIs) is generally ignored.
In this paper, we consider the general Rician fading channel and uplink
transmission of the RIS-assisted CF-mMIMO system under transceiver impairments
and RIS phase noise. To reduce the feedback overhead and power consumption, we
propose a two-timescale transmission scheme to optimize the passive beamformers
at RISs with statistical channel state information (CSI), while transmit
beamformers at access points (APs) are designed based on instantaneous CSI.
Also, the maximum ratio combining (MRC) detection is applied to the central
processing unit (CPU). On this basis, we derive the closed-form approximate
expression of the achievable rate, based on which the impact of HWIs and the
power scaling laws are analyzed to draw useful theoretical insights. To
maximize the users' sum rate or minimum rate, we first transform our rate
expression into a tractable form, and then optimize the phase shifts of RISs
based on an accelerated gradient ascent method. Finally, numerical results are
presented to demonstrate the correctness of our derived expressions and
validate the previous analysis, which provide some guidelines for the practical
application of the imperfect RISs in the CF-mMIMO with transceiver HWIs.
