From 745c774b5fd7666e7f26e637a2642111b503f344 Mon Sep 17 00:00:00 2001 From: Markus Linnala Date: Mon, 21 Sep 2015 16:11:20 +0300 Subject: [PATCH] better way to convert UINT32 to PCHAR --- common/rtusb_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/rtusb_io.c b/common/rtusb_io.c index 7491a0c..9d3eac2 100644 --- a/common/rtusb_io.c +++ b/common/rtusb_io.c @@ -472,21 +472,21 @@ NTSTATUS RTUSBWriteMACRegister( IN BOOLEAN bWriteHigh) { NTSTATUS Status; - UINT32 localVal; + UCHAR localValue[4]; - localVal = Value; + memcpy(localValue, &Value, sizeof(UINT32)); /* MT76xx HW has 4 byte alignment constrained */ if (IS_MT76xx(pAd)) { Status = RTUSBMultiWrite_nBytes( pAd, Offset, - &Value, + (PUCHAR)&localValue, 4, 4); } else { - Status = RTUSBSingleWrite(pAd, Offset, (USHORT)(localVal & 0xffff), bWriteHigh); - Status = RTUSBSingleWrite(pAd, Offset + 2, (USHORT)((localVal & 0xffff0000) >> 16), bWriteHigh); + Status = RTUSBSingleWrite(pAd, Offset, (USHORT)(Value & 0xffff), bWriteHigh); + Status = RTUSBSingleWrite(pAd, Offset + 2, (USHORT)((Value & 0xffff0000) >> 16), bWriteHigh); } return Status;