diff options
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 5ea877221f46..64eb57893602 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
142 | * To date internally, just copy this out to the user. | 142 | * To date internally, just copy this out to the user. |
143 | */ | 143 | */ |
144 | case LMCIOCGINFO: /*fold01*/ | 144 | case LMCIOCGINFO: /*fold01*/ |
145 | if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t))) | 145 | if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof(lmc_ctl_t))) |
146 | return -EFAULT; | 146 | ret = -EFAULT; |
147 | ret = 0; | 147 | else |
148 | ret = 0; | ||
148 | break; | 149 | break; |
149 | 150 | ||
150 | case LMCIOCSINFO: /*fold01*/ | 151 | case LMCIOCSINFO: /*fold01*/ |
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
159 | break; | 160 | break; |
160 | } | 161 | } |
161 | 162 | ||
162 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) | 163 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) { |
163 | return -EFAULT; | 164 | ret = -EFAULT; |
165 | break; | ||
166 | } | ||
164 | 167 | ||
165 | sc->lmc_media->set_status (sc, &ctl); | 168 | sc->lmc_media->set_status (sc, &ctl); |
166 | 169 | ||
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
190 | break; | 193 | break; |
191 | } | 194 | } |
192 | 195 | ||
193 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) | 196 | if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t))) { |
194 | return -EFAULT; | 197 | ret = -EFAULT; |
198 | break; | ||
199 | } | ||
195 | 200 | ||
196 | 201 | ||
197 | if (new_type == old_type) | 202 | if (new_type == old_type) |
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
229 | sc->lmc_xinfo.Magic1 = 0xDEADBEEF; | 234 | sc->lmc_xinfo.Magic1 = 0xDEADBEEF; |
230 | 235 | ||
231 | if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, | 236 | if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo, |
232 | sizeof (struct lmc_xinfo))) | 237 | sizeof(struct lmc_xinfo))) { |
233 | return -EFAULT; | 238 | ret = -EFAULT; |
234 | ret = 0; | 239 | else |
240 | ret = 0; | ||
235 | 241 | ||
236 | break; | 242 | break; |
237 | 243 | ||
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
262 | 268 | ||
263 | if (copy_to_user(ifr->ifr_data, &sc->stats, | 269 | if (copy_to_user(ifr->ifr_data, &sc->stats, |
264 | sizeof (struct lmc_statistics))) | 270 | sizeof (struct lmc_statistics))) |
265 | return -EFAULT; | 271 | ret = -EFAULT; |
266 | 272 | else | |
267 | ret = 0; | 273 | ret = 0; |
268 | break; | 274 | break; |
269 | 275 | ||
270 | case LMCIOCCLEARLMCSTATS: /*fold01*/ | 276 | case LMCIOCCLEARLMCSTATS: /*fold01*/ |
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
292 | break; | 298 | break; |
293 | } | 299 | } |
294 | 300 | ||
295 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t))) | 301 | if (copy_from_user(&ctl, ifr->ifr_data, sizeof(lmc_ctl_t))) { |
296 | return -EFAULT; | 302 | ret = -EFAULT; |
303 | break; | ||
304 | } | ||
297 | sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); | 305 | sc->lmc_media->set_circuit_type(sc, ctl.circuit_type); |
298 | sc->ictl.circuit_type = ctl.circuit_type; | 306 | sc->ictl.circuit_type = ctl.circuit_type; |
299 | ret = 0; | 307 | ret = 0; |
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
318 | 326 | ||
319 | #ifdef DEBUG | 327 | #ifdef DEBUG |
320 | case LMCIOCDUMPEVENTLOG: | 328 | case LMCIOCDUMPEVENTLOG: |
321 | if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof (u32))) | 329 | if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof(u32))) { |
322 | return -EFAULT; | 330 | ret = -EFAULT; |
331 | break; | ||
332 | } | ||
323 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) | 333 | if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf))) |
324 | return -EFAULT; | 334 | ret = -EFAULT; |
335 | else | ||
336 | ret = 0; | ||
325 | 337 | ||
326 | ret = 0; | ||
327 | break; | 338 | break; |
328 | #endif /* end ifdef _DBG_EVENTLOG */ | 339 | #endif /* end ifdef _DBG_EVENTLOG */ |
329 | case LMCIOCT1CONTROL: /*fold01*/ | 340 | case LMCIOCT1CONTROL: /*fold01*/ |
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ | |||
346 | */ | 357 | */ |
347 | netif_stop_queue(dev); | 358 | netif_stop_queue(dev); |
348 | 359 | ||
349 | if (copy_from_user(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control))) | 360 | if (copy_from_user(&xc, ifr->ifr_data, sizeof(struct lmc_xilinx_control))) { |
350 | return -EFAULT; | 361 | ret = -EFAULT; |
362 | break; | ||
363 | } | ||
351 | switch(xc.command){ | 364 | switch(xc.command){ |
352 | case lmc_xilinx_reset: /*fold02*/ | 365 | case lmc_xilinx_reset: /*fold02*/ |
353 | { | 366 | { |