Staging: crystalhd: Fix different address spaces warning
authorMonam Agarwal <monamagarwal123@gmail.com>
Wed, 5 Mar 2014 00:43:54 +0000 (06:13 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 23:16:26 +0000 (15:16 -0800)
This patch fixes following sparse warning in crystalhd_lnx.c
WARNING: incorrect type in argument

Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/crystalhd/crystalhd_lnx.c

index 99eefd0291c31503199621dfa9bcb9d7e3438d21..c561feddb0df08486bb6bc6528f343f03b514ddd 100644 (file)
@@ -111,7 +111,7 @@ static void chd_dec_free_iodata(struct crystalhd_adp *adp,
        spin_unlock_irqrestore(&adp->lock, flags);
 }
 
-static inline int crystalhd_user_data(unsigned long ud, void *dr,
+static inline int crystalhd_user_data(void __user *ud, void *dr,
                         int size, int set)
 {
        int rc;
@@ -122,9 +122,9 @@ static inline int crystalhd_user_data(unsigned long ud, void *dr,
        }
 
        if (set)
-               rc = copy_to_user((void *)ud, dr, size);
+               rc = copy_to_user(ud, dr, size);
        else
-               rc = copy_from_user(dr, (void *)ud, size);
+               rc = copy_from_user(dr, ud, size);
 
        if (rc) {
                BCMLOG_ERR("Invalid args for command\n");
@@ -153,7 +153,7 @@ static int chd_dec_fetch_cdata(struct crystalhd_adp *adp,
 
        io->add_cdata_sz = m_sz;
        ua_off = ua + sizeof(io->udata);
-       rc = crystalhd_user_data(ua_off, io->add_cdata, io->add_cdata_sz, 0);
+       rc = crystalhd_user_data((void __user *)ua_off, io->add_cdata, io->add_cdata_sz, 0);
        if (rc) {
                BCMLOG_ERR("failed to pull add_cdata sz:%x ua_off:%x\n",
                           io->add_cdata_sz, (unsigned int)ua_off);
@@ -178,7 +178,7 @@ static int chd_dec_release_cdata(struct crystalhd_adp *adp,
 
        if (io->cmd != BCM_IOC_FW_DOWNLOAD) {
                ua_off = ua + sizeof(io->udata);
-               rc = crystalhd_user_data(ua_off, io->add_cdata,
+               rc = crystalhd_user_data((void __user *)ua_off, io->add_cdata,
                                        io->add_cdata_sz, 1);
                if (rc) {
                        BCMLOG_ERR(
@@ -208,7 +208,7 @@ static int chd_dec_proc_user_data(struct crystalhd_adp *adp,
                return -EINVAL;
        }
 
-       rc = crystalhd_user_data(ua, &io->udata, sizeof(io->udata), set);
+       rc = crystalhd_user_data((void __user *)ua, &io->udata, sizeof(io->udata), set);
        if (rc) {
                BCMLOG_ERR("failed to %s iodata\n", (set ? "set" : "get"));
                return rc;