Skip to content

Commit c50356d

Browse files
committed
Fix the condition
Make the comparison work with the address rather than the pointer
1 parent 0c0fb10 commit c50356d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/cynq/dma/datamover.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ DMADataMover::DMADataMover(const uint64_t addr,
4545

4646
params->addr_ = addr;
4747
params->hw_params_ = hwparams;
48-
params->dma_ = nullptr;
4948

5049
/* Create the DMA accessor */
5150
if (static_cast<uint64_t>(0ul) != addr) {
@@ -98,7 +97,7 @@ DMADataMover::~DMADataMover() {
9897
/* The assumption is that at this point, it is ok */
9998
auto params =
10099
dynamic_cast<DMADataMoverParameters *>(data_mover_params_.get());
101-
if (params->dma_) {
100+
if (static_cast<uint64_t>(0ul) != params->addr_) {
102101
PYNQ_closeDMA(&params->dma_);
103102
}
104103
}
@@ -132,7 +131,7 @@ Status DMADataMover::Upload(const std::shared_ptr<IMemory> mem,
132131
}
133132

134133
/* Issue transaction */
135-
if (params->dma_) {
134+
if (static_cast<uint64_t>(0ul) != params->addr_) {
136135
/* Get device pointer */
137136
std::shared_ptr<uint8_t> ptr = mem->DeviceAddress<uint8_t>();
138137
if (!ptr) {
@@ -185,7 +184,7 @@ Status DMADataMover::Download(const std::shared_ptr<IMemory> mem,
185184
}
186185

187186
/* Issue transaction */
188-
if (params->dma_) {
187+
if (static_cast<uint64_t>(0ul) != params->addr_) {
189188
std::shared_ptr<uint8_t> ptr = mem->DeviceAddress<uint8_t>();
190189

191190
/* Get device pointer */
@@ -217,7 +216,7 @@ Status DMADataMover::Sync(const SyncType type) {
217216
auto params =
218217
dynamic_cast<DMADataMoverParameters *>(data_mover_params_.get());
219218

220-
if (!params->dma_) {
219+
if (static_cast<uint64_t>(0ul) == params->addr_) {
221220
return Status{};
222221
}
223222

0 commit comments

Comments
 (0)