diff options
author | Andrew H. Richter <richtera@us.ibm.com> | 2009-03-23 23:27:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-24 18:24:50 -0400 |
commit | b9d2fceecb6afd9dead4fd2488a543b302a3272e (patch) | |
tree | ddfa9fc2bea3673c141f01eac894b77f20f2290a | |
parent | e2fc8cb4fedf57a63c05cd1e0f6e4f0e0238614a (diff) |
claw: fix minor findings from code analysis tool
This patch fixes two problems in the claw driver identified by
static code analysis:
o Change in case differentiation of received sense codes
o Use correct data length in claw hard_start_xmit routine
Signed-off-by: Andrew H. Richter <richtera@us.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/s390/net/claw.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index a4524ecd9dc..30a43cc79e7 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -1033,7 +1033,7 @@ static int | |||
1033 | pages_to_order_of_mag(int num_of_pages) | 1033 | pages_to_order_of_mag(int num_of_pages) |
1034 | { | 1034 | { |
1035 | int order_of_mag=1; /* assume 2 pages */ | 1035 | int order_of_mag=1; /* assume 2 pages */ |
1036 | int nump=2; | 1036 | int nump; |
1037 | 1037 | ||
1038 | CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages); | 1038 | CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages); |
1039 | if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */ | 1039 | if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */ |
@@ -1187,37 +1187,31 @@ ccw_check_unit_check(struct chbk * p_ch, unsigned char sense ) | |||
1187 | dev_warn(dev, "The communication peer of %s disconnected\n", | 1187 | dev_warn(dev, "The communication peer of %s disconnected\n", |
1188 | ndev->name); | 1188 | ndev->name); |
1189 | 1189 | ||
1190 | if (sense & 0x40) { | 1190 | if (sense & 0x40) { |
1191 | if (sense & 0x01) { | 1191 | if (sense & 0x01) { |
1192 | dev_warn(dev, "The remote channel adapter for" | 1192 | dev_warn(dev, "The remote channel adapter for" |
1193 | " %s has been reset\n", | 1193 | " %s has been reset\n", |
1194 | ndev->name); | 1194 | ndev->name); |
1195 | } | 1195 | } |
1196 | } | 1196 | } else if (sense & 0x20) { |
1197 | else if (sense & 0x20) { | 1197 | if (sense & 0x04) { |
1198 | if (sense & 0x04) { | ||
1199 | dev_warn(dev, "A data streaming timeout occurred" | 1198 | dev_warn(dev, "A data streaming timeout occurred" |
1200 | " for %s\n", | 1199 | " for %s\n", |
1201 | ndev->name); | 1200 | ndev->name); |
1202 | } | 1201 | } else if (sense & 0x10) { |
1203 | else { | ||
1204 | dev_warn(dev, "A data transfer parity error occurred" | ||
1205 | " for %s\n", | ||
1206 | ndev->name); | ||
1207 | } | ||
1208 | } | ||
1209 | else if (sense & 0x10) { | ||
1210 | if (sense & 0x20) { | ||
1211 | dev_warn(dev, "The remote channel adapter for %s" | 1202 | dev_warn(dev, "The remote channel adapter for %s" |
1212 | " is faulty\n", | 1203 | " is faulty\n", |
1213 | ndev->name); | 1204 | ndev->name); |
1214 | } | 1205 | } else { |
1215 | else { | 1206 | dev_warn(dev, "A data transfer parity error occurred" |
1216 | dev_warn(dev, "A read data parity error occurred" | ||
1217 | " for %s\n", | 1207 | " for %s\n", |
1218 | ndev->name); | 1208 | ndev->name); |
1219 | } | 1209 | } |
1220 | } | 1210 | } else if (sense & 0x10) { |
1211 | dev_warn(dev, "A read data parity error occurred" | ||
1212 | " for %s\n", | ||
1213 | ndev->name); | ||
1214 | } | ||
1221 | 1215 | ||
1222 | } /* end of ccw_check_unit_check */ | 1216 | } /* end of ccw_check_unit_check */ |
1223 | 1217 | ||
@@ -1254,7 +1248,7 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) | |||
1254 | break; | 1248 | break; |
1255 | } | 1249 | } |
1256 | 1250 | ||
1257 | return 0; | 1251 | return rc; |
1258 | } /* end of find_link */ | 1252 | } /* end of find_link */ |
1259 | 1253 | ||
1260 | /*-------------------------------------------------------------------* | 1254 | /*-------------------------------------------------------------------* |
@@ -1366,7 +1360,10 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) | |||
1366 | privptr->p_write_free_chain=p_this_ccw->next; | 1360 | privptr->p_write_free_chain=p_this_ccw->next; |
1367 | p_this_ccw->next=NULL; | 1361 | p_this_ccw->next=NULL; |
1368 | --privptr->write_free_count; /* -1 */ | 1362 | --privptr->write_free_count; /* -1 */ |
1369 | bytesInThisBuffer=len_of_data; | 1363 | if (len_of_data >= privptr->p_env->write_size) |
1364 | bytesInThisBuffer = privptr->p_env->write_size; | ||
1365 | else | ||
1366 | bytesInThisBuffer = len_of_data; | ||
1370 | memcpy( p_this_ccw->p_buffer,pDataAddress, bytesInThisBuffer); | 1367 | memcpy( p_this_ccw->p_buffer,pDataAddress, bytesInThisBuffer); |
1371 | len_of_data-=bytesInThisBuffer; | 1368 | len_of_data-=bytesInThisBuffer; |
1372 | pDataAddress+=(unsigned long)bytesInThisBuffer; | 1369 | pDataAddress+=(unsigned long)bytesInThisBuffer; |
@@ -2517,7 +2514,6 @@ unpack_read(struct net_device *dev ) | |||
2517 | p_dev = &privptr->channel[READ].cdev->dev; | 2514 | p_dev = &privptr->channel[READ].cdev->dev; |
2518 | p_env = privptr->p_env; | 2515 | p_env = privptr->p_env; |
2519 | p_this_ccw=privptr->p_read_active_first; | 2516 | p_this_ccw=privptr->p_read_active_first; |
2520 | i=0; | ||
2521 | while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) { | 2517 | while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) { |
2522 | pack_off = 0; | 2518 | pack_off = 0; |
2523 | p = 0; | 2519 | p = 0; |