Rewrite get_data_src_dst_mac() to test To DS and From DS only once; that
also more clearly means that there's no way to escape from that function
without setting both pointers, so the compiler doesn't think there's a
way to do so.
#define ADDR3 (p + 16)
#define ADDR4 (p + 24)
- if (!FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
- *srcp = ADDR2;
- *dstp = ADDR1;
- } else if (!FC_TO_DS(fc) && FC_FROM_DS(fc)) {
- *srcp = ADDR3;
- *dstp = ADDR1;
- } else if (FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
- *srcp = ADDR2;
- *dstp = ADDR3;
- } else if (FC_TO_DS(fc) && FC_FROM_DS(fc)) {
- *srcp = ADDR4;
- *dstp = ADDR3;
+ if (!FC_TO_DS(fc)) {
+ if (!FC_FROM_DS(fc)) {
+ /* not To DS and not From DS */
+ *srcp = ADDR2;
+ *dstp = ADDR1;
+ } else {
+ /* not To DS and From DS */
+ *srcp = ADDR3;
+ *dstp = ADDR1;
+ }
+ } else {
+ if (!FC_FROM_DS(fc)) {
+ /* From DS and not To DS */
+ *srcp = ADDR2;
+ *dstp = ADDR3;
+ } else {
+ /* To DS and From DS */
+ *srcp = ADDR4;
+ *dstp = ADDR3;
+ }
}
#undef ADDR1