[PATCH] aoe 6/12: Alexey Dobriyan sparse cleanup

Alexey Dobriyan sparse cleanup

Signed-off-by: Alexey Dobriyan <adobriyan@mail.ru>
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


authored by ecashin@coraid.com and committed by Greg KH 63e9cc5d 03347936

+32 -38
+5 -5
drivers/block/aoe/aoe.h
··· 39 struct aoe_hdr { 40 unsigned char dst[6]; 41 unsigned char src[6]; 42 - unsigned char type[2]; 43 unsigned char verfl; 44 unsigned char err; 45 - unsigned char major[2]; 46 unsigned char minor; 47 unsigned char cmd; 48 - unsigned char tag[4]; 49 }; 50 51 struct aoe_atahdr { ··· 63 }; 64 65 struct aoe_cfghdr { 66 - unsigned char bufcnt[2]; 67 - unsigned char fwver[2]; 68 unsigned char res; 69 unsigned char aoeccmd; 70 unsigned char cslen[2];
··· 39 struct aoe_hdr { 40 unsigned char dst[6]; 41 unsigned char src[6]; 42 + __be16 type; 43 unsigned char verfl; 44 unsigned char err; 45 + __be16 major; 46 unsigned char minor; 47 unsigned char cmd; 48 + __be32 tag; 49 }; 50 51 struct aoe_atahdr { ··· 63 }; 64 65 struct aoe_cfghdr { 66 + __be16 bufcnt; 67 + __be16 fwver; 68 unsigned char res; 69 unsigned char aoeccmd; 70 unsigned char cslen[2];
+23 -29
drivers/block/aoe/aoecmd.c
··· 90 static int 91 aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) 92 { 93 - u16 type = __constant_cpu_to_be16(ETH_P_AOE); 94 - u16 aoemajor = __cpu_to_be16(d->aoemajor); 95 u32 host_tag = newtag(d); 96 - u32 tag = __cpu_to_be32(host_tag); 97 98 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 99 memcpy(h->dst, d->addr, sizeof h->dst); 100 - memcpy(h->type, &type, sizeof type); 101 h->verfl = AOE_HVER; 102 - memcpy(h->major, &aoemajor, sizeof aoemajor); 103 h->minor = d->aoeminor; 104 h->cmd = AOECMD_ATA; 105 - memcpy(h->tag, &tag, sizeof tag); 106 107 return host_tag; 108 } ··· 212 struct aoe_hdr *h; 213 char buf[128]; 214 u32 n; 215 - u32 net_tag; 216 217 n = newtag(d); 218 ··· 223 224 h = (struct aoe_hdr *) f->data; 225 f->tag = n; 226 - net_tag = __cpu_to_be32(n); 227 - memcpy(h->tag, &net_tag, sizeof net_tag); 228 229 skb = skb_prepare(d, f); 230 if (skb) { ··· 303 u16 n; 304 305 /* word 83: command set supported */ 306 - n = __le16_to_cpu(*((u16 *) &id[83<<1])); 307 308 /* word 86: command set/feature enabled */ 309 - n |= __le16_to_cpu(*((u16 *) &id[86<<1])); 310 311 if (n & (1<<10)) { /* bit 10: LBA 48 */ 312 d->flags |= DEVFL_EXT; 313 314 /* word 100: number lba48 sectors */ 315 - ssize = __le64_to_cpu(*((u64 *) &id[100<<1])); 316 317 /* set as in ide-disk.c:init_idedisk_capacity */ 318 d->geo.cylinders = ssize; ··· 323 d->flags &= ~DEVFL_EXT; 324 325 /* number lba28 sectors */ 326 - ssize = __le32_to_cpu(*((u32 *) &id[60<<1])); 327 328 /* NOTE: obsolete in ATA 6 */ 329 - d->geo.cylinders = __le16_to_cpu(*((u16 *) &id[54<<1])); 330 - d->geo.heads = __le16_to_cpu(*((u16 *) &id[55<<1])); 331 - d->geo.sectors = __le16_to_cpu(*((u16 *) &id[56<<1])); 332 } 333 d->ssize = ssize; 334 d->geo.start = 0; ··· 378 u16 aoemajor; 379 380 hin = (struct aoe_hdr *) skb->mac.raw; 381 - aoemajor = __be16_to_cpu(*((u16 *) hin->major)); 382 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 383 if (d == NULL) { 384 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " ··· 390 391 spin_lock_irqsave(&d->lock, flags); 392 393 - f = getframe(d, __be32_to_cpu(*((u32 *) hin->tag))); 394 if (f == NULL) { 395 spin_unlock_irqrestore(&d->lock, flags); 396 snprintf(ebuf, sizeof ebuf, 397 "%15s e%d.%d tag=%08x@%08lx\n", 398 "unexpected rsp", 399 - __be16_to_cpu(*((u16 *) hin->major)), 400 hin->minor, 401 - __be32_to_cpu(*((u32 *) hin->tag)), 402 jiffies); 403 aoechr_error(ebuf); 404 return; ··· 448 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 449 "outbound ata command %2.2Xh for %d.%d\n", 450 ahout->cmdstat, 451 - __be16_to_cpu(*((u16 *) hin->major)), 452 hin->minor); 453 } 454 } ··· 482 struct aoe_cfghdr *ch; 483 struct sk_buff *skb, *sl; 484 struct net_device *ifp; 485 - u16 aoe_type = __constant_cpu_to_be16(ETH_P_AOE); 486 - u16 net_aoemajor = __cpu_to_be16(aoemajor); 487 488 sl = NULL; 489 ··· 501 502 memset(h->dst, 0xff, sizeof h->dst); 503 memcpy(h->src, ifp->dev_addr, sizeof h->src); 504 - memcpy(h->type, &aoe_type, sizeof aoe_type); 505 h->verfl = AOE_HVER; 506 - memcpy(h->major, &net_aoemajor, sizeof net_aoemajor); 507 h->minor = aoeminor; 508 h->cmd = AOECMD_CFG; 509 ··· 569 struct aoedev *d; 570 struct aoe_hdr *h; 571 struct aoe_cfghdr *ch; 572 - ulong flags, bufcnt, sysminor, aoemajor; 573 struct sk_buff *sl; 574 enum { MAXFRAMES = 8 }; 575 ··· 581 * Enough people have their dip switches set backwards to 582 * warrant a loud message for this special case. 583 */ 584 - aoemajor = __be16_to_cpu(*((u16 *) h->major)); 585 if (aoemajor == 0xfff) { 586 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 587 "address is all ones. Check shelf dip switches\n"); ··· 596 return; 597 } 598 599 - bufcnt = __be16_to_cpu(*((u16 *) ch->bufcnt)); 600 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 601 bufcnt = MAXFRAMES; 602 ··· 613 return; 614 } 615 616 - d->fw_ver = __be16_to_cpu(*((u16 *) ch->fwver)); 617 618 /* we get here only if the device is new */ 619 sl = aoecmd_ata_id(d);
··· 90 static int 91 aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) 92 { 93 u32 host_tag = newtag(d); 94 95 memcpy(h->src, d->ifp->dev_addr, sizeof h->src); 96 memcpy(h->dst, d->addr, sizeof h->dst); 97 + h->type = __constant_cpu_to_be16(ETH_P_AOE); 98 h->verfl = AOE_HVER; 99 + h->major = cpu_to_be16(d->aoemajor); 100 h->minor = d->aoeminor; 101 h->cmd = AOECMD_ATA; 102 + h->tag = cpu_to_be32(host_tag); 103 104 return host_tag; 105 } ··· 215 struct aoe_hdr *h; 216 char buf[128]; 217 u32 n; 218 219 n = newtag(d); 220 ··· 227 228 h = (struct aoe_hdr *) f->data; 229 f->tag = n; 230 + h->tag = cpu_to_be32(n); 231 232 skb = skb_prepare(d, f); 233 if (skb) { ··· 308 u16 n; 309 310 /* word 83: command set supported */ 311 + n = le16_to_cpup((__le16 *) &id[83<<1]); 312 313 /* word 86: command set/feature enabled */ 314 + n |= le16_to_cpup((__le16 *) &id[86<<1]); 315 316 if (n & (1<<10)) { /* bit 10: LBA 48 */ 317 d->flags |= DEVFL_EXT; 318 319 /* word 100: number lba48 sectors */ 320 + ssize = le64_to_cpup((__le64 *) &id[100<<1]); 321 322 /* set as in ide-disk.c:init_idedisk_capacity */ 323 d->geo.cylinders = ssize; ··· 328 d->flags &= ~DEVFL_EXT; 329 330 /* number lba28 sectors */ 331 + ssize = le32_to_cpup((__le32 *) &id[60<<1]); 332 333 /* NOTE: obsolete in ATA 6 */ 334 + d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]); 335 + d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]); 336 + d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]); 337 } 338 d->ssize = ssize; 339 d->geo.start = 0; ··· 383 u16 aoemajor; 384 385 hin = (struct aoe_hdr *) skb->mac.raw; 386 + aoemajor = be16_to_cpu(hin->major); 387 d = aoedev_by_aoeaddr(aoemajor, hin->minor); 388 if (d == NULL) { 389 snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " ··· 395 396 spin_lock_irqsave(&d->lock, flags); 397 398 + f = getframe(d, be32_to_cpu(hin->tag)); 399 if (f == NULL) { 400 spin_unlock_irqrestore(&d->lock, flags); 401 snprintf(ebuf, sizeof ebuf, 402 "%15s e%d.%d tag=%08x@%08lx\n", 403 "unexpected rsp", 404 + be16_to_cpu(hin->major), 405 hin->minor, 406 + be32_to_cpu(hin->tag), 407 jiffies); 408 aoechr_error(ebuf); 409 return; ··· 453 printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " 454 "outbound ata command %2.2Xh for %d.%d\n", 455 ahout->cmdstat, 456 + be16_to_cpu(hin->major), 457 hin->minor); 458 } 459 } ··· 487 struct aoe_cfghdr *ch; 488 struct sk_buff *skb, *sl; 489 struct net_device *ifp; 490 491 sl = NULL; 492 ··· 508 509 memset(h->dst, 0xff, sizeof h->dst); 510 memcpy(h->src, ifp->dev_addr, sizeof h->src); 511 + h->type = __constant_cpu_to_be16(ETH_P_AOE); 512 h->verfl = AOE_HVER; 513 + h->major = cpu_to_be16(aoemajor); 514 h->minor = aoeminor; 515 h->cmd = AOECMD_CFG; 516 ··· 576 struct aoedev *d; 577 struct aoe_hdr *h; 578 struct aoe_cfghdr *ch; 579 + ulong flags, sysminor, aoemajor; 580 + u16 bufcnt; 581 struct sk_buff *sl; 582 enum { MAXFRAMES = 8 }; 583 ··· 587 * Enough people have their dip switches set backwards to 588 * warrant a loud message for this special case. 589 */ 590 + aoemajor = be16_to_cpu(h->major); 591 if (aoemajor == 0xfff) { 592 printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " 593 "address is all ones. Check shelf dip switches\n"); ··· 602 return; 603 } 604 605 + bufcnt = be16_to_cpu(ch->bufcnt); 606 if (bufcnt > MAXFRAMES) /* keep it reasonable */ 607 bufcnt = MAXFRAMES; 608 ··· 619 return; 620 } 621 622 + d->fw_ver = be16_to_cpu(ch->fwver); 623 624 /* we get here only if the device is new */ 625 sl = aoecmd_ata_id(d);
+4 -4
drivers/block/aoe/aoenet.c
··· 69 u64 70 mac_addr(char addr[6]) 71 { 72 - u64 n = 0; 73 char *p = (char *) &n; 74 75 memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */ ··· 108 aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) 109 { 110 struct aoe_hdr *h; 111 - ulong n; 112 113 skb = skb_check(skb); 114 if (!skb) ··· 121 skb_push(skb, ETH_HLEN); /* (1) */ 122 123 h = (struct aoe_hdr *) skb->mac.raw; 124 - n = __be32_to_cpu(*((u32 *) h->tag)); 125 if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) 126 goto exit; 127 ··· 132 if (net_ratelimit()) 133 printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " 134 "ecode=%d '%s'\n", 135 - __be16_to_cpu(*((u16 *) h->major)), h->minor, 136 h->err, aoe_errlist[n]); 137 goto exit; 138 }
··· 69 u64 70 mac_addr(char addr[6]) 71 { 72 + __be64 n = 0; 73 char *p = (char *) &n; 74 75 memcpy(p + 2, addr, 6); /* (sizeof addr != 6) */ ··· 108 aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt) 109 { 110 struct aoe_hdr *h; 111 + u32 n; 112 113 skb = skb_check(skb); 114 if (!skb) ··· 121 skb_push(skb, ETH_HLEN); /* (1) */ 122 123 h = (struct aoe_hdr *) skb->mac.raw; 124 + n = be32_to_cpu(h->tag); 125 if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) 126 goto exit; 127 ··· 132 if (net_ratelimit()) 133 printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; " 134 "ecode=%d '%s'\n", 135 + be16_to_cpu(h->major), h->minor, 136 h->err, aoe_errlist[n]); 137 goto exit; 138 }