lms: Move rx_buffers allocation to constructor
Release is done in destructor, so let's move allocation to constructor since there's really no need to have them in open() which is already quite complex and large. Change-Id: I8a4fd973590c4c165abd8f2837b2da8fc14a2066
This commit is contained in:
parent
a979f5f32b
commit
e7f6a27ab6
|
@ -58,6 +58,11 @@ LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t c
|
|||
tx_gains.resize(chans);
|
||||
|
||||
rx_buffers.resize(chans);
|
||||
|
||||
/* Set up per-channel Rx timestamp based Ring buffers */
|
||||
for (size_t i = 0; i < rx_buffers.size(); i++)
|
||||
rx_buffers[i] = new smpl_buf(SAMPLE_BUF_SZ / sizeof(uint32_t));
|
||||
|
||||
}
|
||||
|
||||
LMSDevice::~LMSDevice()
|
||||
|
@ -243,10 +248,6 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
|
|||
goto out_close;
|
||||
}
|
||||
|
||||
/* Set up per-channel Rx timestamp based Ring buffers */
|
||||
for (size_t i = 0; i < rx_buffers.size(); i++)
|
||||
rx_buffers[i] = new smpl_buf(SAMPLE_BUF_SZ / sizeof(uint32_t));
|
||||
|
||||
return NORMAL;
|
||||
|
||||
out_close:
|
||||
|
|
Loading…
Reference in New Issue