Skip to content

Commit 9df2b0d

Browse files
MonamAgarwalgregkh
authored andcommitted
Staging: crystalhd: Fix different address spaces warning
This patch fixes following sparse warning in crystalhd_lnx.c WARNING: incorrect type in argument Signed-off-by: Monam Agarwal <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6df1a83 commit 9df2b0d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/staging/crystalhd/crystalhd_lnx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static void chd_dec_free_iodata(struct crystalhd_adp *adp,
111111
spin_unlock_irqrestore(&adp->lock, flags);
112112
}
113113

114-
static inline int crystalhd_user_data(unsigned long ud, void *dr,
114+
static inline int crystalhd_user_data(void __user *ud, void *dr,
115115
int size, int set)
116116
{
117117
int rc;
@@ -122,9 +122,9 @@ static inline int crystalhd_user_data(unsigned long ud, void *dr,
122122
}
123123

124124
if (set)
125-
rc = copy_to_user((void *)ud, dr, size);
125+
rc = copy_to_user(ud, dr, size);
126126
else
127-
rc = copy_from_user(dr, (void *)ud, size);
127+
rc = copy_from_user(dr, ud, size);
128128

129129
if (rc) {
130130
BCMLOG_ERR("Invalid args for command\n");
@@ -153,7 +153,7 @@ static int chd_dec_fetch_cdata(struct crystalhd_adp *adp,
153153

154154
io->add_cdata_sz = m_sz;
155155
ua_off = ua + sizeof(io->udata);
156-
rc = crystalhd_user_data(ua_off, io->add_cdata, io->add_cdata_sz, 0);
156+
rc = crystalhd_user_data((void __user *)ua_off, io->add_cdata, io->add_cdata_sz, 0);
157157
if (rc) {
158158
BCMLOG_ERR("failed to pull add_cdata sz:%x ua_off:%x\n",
159159
io->add_cdata_sz, (unsigned int)ua_off);
@@ -178,7 +178,7 @@ static int chd_dec_release_cdata(struct crystalhd_adp *adp,
178178

179179
if (io->cmd != BCM_IOC_FW_DOWNLOAD) {
180180
ua_off = ua + sizeof(io->udata);
181-
rc = crystalhd_user_data(ua_off, io->add_cdata,
181+
rc = crystalhd_user_data((void __user *)ua_off, io->add_cdata,
182182
io->add_cdata_sz, 1);
183183
if (rc) {
184184
BCMLOG_ERR(
@@ -208,7 +208,7 @@ static int chd_dec_proc_user_data(struct crystalhd_adp *adp,
208208
return -EINVAL;
209209
}
210210

211-
rc = crystalhd_user_data(ua, &io->udata, sizeof(io->udata), set);
211+
rc = crystalhd_user_data((void __user *)ua, &io->udata, sizeof(io->udata), set);
212212
if (rc) {
213213
BCMLOG_ERR("failed to %s iodata\n", (set ? "set" : "get"));
214214
return rc;

0 commit comments

Comments
 (0)