Staging: unisys: Fixup sparse warnings for dereferencing noderef types.
authorKen Cox <jkc@redhat.com>
Thu, 22 May 2014 17:31:13 +0000 (12:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 11:21:10 +0000 (20:21 +0900)
Fixed the usage of the following so they don't try to dereference
pointers to iomem.
CHANNEL_U64_MISMATCH
CHANNEL_U32_MISMATCH
wait_for_valid_guid

Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/common-spar/include/channels/channel.h
drivers/staging/unisys/include/uisutils.h
drivers/staging/unisys/uislib/uislib.c

index 237a852c2fc091b3f37e2c6eeeaf0664b3022545..d19711de11402b05ff9e95afe94e466ba63bc847 100644 (file)
@@ -333,8 +333,9 @@ ULTRA_check_channel_client(void __iomem *pChannel,
                           (pChannel))->Size) < expectedMinBytes) {
                        CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName,
                                             "size", expectedMinBytes,
-                                            ((CHANNEL_HEADER __iomem *)
-                                             (pChannel))->Size, fileName,
+                                            readq(&((CHANNEL_HEADER __iomem *)
+                                                    (pChannel))->Size),
+                                            fileName,
                                             lineNumber, logCtx);
                        return 0;
                }
@@ -344,9 +345,9 @@ ULTRA_check_channel_client(void __iomem *pChannel,
                    != expectedVersionId) {
                        CHANNEL_U32_MISMATCH(expectedTypeGuid, channelName,
                                             "version", expectedVersionId,
-                                            ((CHANNEL_HEADER __iomem *)
-                                             (pChannel))->VersionId, fileName,
-                                            lineNumber, logCtx);
+                                            readl(&((CHANNEL_HEADER __iomem *)
+                                                    (pChannel))->VersionId),
+                                            fileName, lineNumber, logCtx);
                        return 0;
                }
        if (expectedSignature > 0)      /* caller wants us to verify
@@ -355,8 +356,9 @@ ULTRA_check_channel_client(void __iomem *pChannel,
                    != expectedSignature) {
                        CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName,
                                             "signature", expectedSignature,
-                                            ((CHANNEL_HEADER __iomem *)
-                                             (pChannel))->Signature, fileName,
+                                            readq(&((CHANNEL_HEADER __iomem *)
+                                                    (pChannel))->Signature),
+                                            fileName,
                                             lineNumber, logCtx);
                        return 0;
                }
index f4845f2ffa06b41adcaf5e384dcc3b30bd9027d8..70776c93cc50484f79e33267efa46ea2ff3d4257 100644 (file)
@@ -194,14 +194,21 @@ struct chaninfo {
  * correctly at DEVICE_CREATE time, INSTEAD OF waiting until
  * DEVICE_CONFIGURE time.
  */
-#define WAIT_FOR_VALID_GUID(guid) \
-       do {                                               \
-               while (uuid_le_cmp(guid, NULL_UUID_LE) == 0) {  \
-                       LOGERR("Waiting for non-0 GUID (why???)...\n"); \
-                       UIS_THREAD_WAIT_SEC(5);                         \
-               }                                                       \
-               LOGERR("OK... GUID is non-0 now\n");                    \
-       } while (0)
+static inline void
+wait_for_valid_guid(uuid_le __iomem *guid)
+{
+       uuid_le tmpguid;
+
+       while (1) {
+               memcpy_fromio((void *)&tmpguid,
+                             (void __iomem *)guid, sizeof(uuid_le));
+               if (uuid_le_cmp(tmpguid, NULL_UUID_LE) != 0)
+                       break;
+               LOGERR("Waiting for non-0 GUID (why???)...\n");
+               UIS_THREAD_WAIT_SEC(5);
+       }
+       LOGERR("OK... GUID is non-0 now\n");
+}
 
 /* CopyFragsInfoFromSkb returns the number of entries added to frags array
  * Returns -1 on failure.
index e3903ee72443e58122804259a4a825991b83c7a7..d4a7ef821bae50e484caae8c5e2793a19d82e2a2 100644 (file)
@@ -447,7 +447,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
                                struct guest_msgs cmd;
                                if (!uuid_le_cmp(dev->channelTypeGuid,
                                     UltraVhbaChannelProtocolGuid)) {
-                                       WAIT_FOR_VALID_GUID(((CHANNEL_HEADER
+                                       wait_for_valid_guid(&((CHANNEL_HEADER
                                                              __iomem *) (dev->
                                                                  chanptr))->
                                                            Type);
@@ -472,7 +472,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
                                } else
                                    if (!uuid_le_cmp(dev->channelTypeGuid,
                                         UltraVnicChannelProtocolGuid)) {
-                                       WAIT_FOR_VALID_GUID(((CHANNEL_HEADER
+                                       wait_for_valid_guid(&((CHANNEL_HEADER
                                                              __iomem *) (dev->
                                                                  chanptr))->
                                                            Type);