Commit b9d2fcee authored by Andrew H. Richter's avatar Andrew H. Richter Committed by David S. Miller

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: default avatarAndrew H. Richter <richtera@us.ibm.com>
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e2fc8cb4
...@@ -1033,7 +1033,7 @@ static int ...@@ -1033,7 +1033,7 @@ static int
pages_to_order_of_mag(int num_of_pages) pages_to_order_of_mag(int num_of_pages)
{ {
int order_of_mag=1; /* assume 2 pages */ int order_of_mag=1; /* assume 2 pages */
int nump=2; int nump;
CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages); CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages);
if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */ 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,37 +1187,31 @@ ccw_check_unit_check(struct chbk * p_ch, unsigned char sense )
dev_warn(dev, "The communication peer of %s disconnected\n", dev_warn(dev, "The communication peer of %s disconnected\n",
ndev->name); ndev->name);
if (sense & 0x40) { if (sense & 0x40) {
if (sense & 0x01) { if (sense & 0x01) {
dev_warn(dev, "The remote channel adapter for" dev_warn(dev, "The remote channel adapter for"
" %s has been reset\n", " %s has been reset\n",
ndev->name); ndev->name);
} }
} } else if (sense & 0x20) {
else if (sense & 0x20) { if (sense & 0x04) {
if (sense & 0x04) {
dev_warn(dev, "A data streaming timeout occurred" dev_warn(dev, "A data streaming timeout occurred"
" for %s\n", " for %s\n",
ndev->name); ndev->name);
} } else if (sense & 0x10) {
else {
dev_warn(dev, "A data transfer parity error occurred"
" for %s\n",
ndev->name);
}
}
else if (sense & 0x10) {
if (sense & 0x20) {
dev_warn(dev, "The remote channel adapter for %s" dev_warn(dev, "The remote channel adapter for %s"
" is faulty\n", " is faulty\n",
ndev->name); ndev->name);
} } else {
else { dev_warn(dev, "A data transfer parity error occurred"
dev_warn(dev, "A read data parity error occurred"
" for %s\n", " for %s\n",
ndev->name); ndev->name);
} }
} } else if (sense & 0x10) {
dev_warn(dev, "A read data parity error occurred"
" for %s\n",
ndev->name);
}
} /* end of ccw_check_unit_check */ } /* end of ccw_check_unit_check */
...@@ -1254,7 +1248,7 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) ...@@ -1254,7 +1248,7 @@ find_link(struct net_device *dev, char *host_name, char *ws_name )
break; break;
} }
return 0; return rc;
} /* end of find_link */ } /* end of find_link */
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
...@@ -1366,7 +1360,10 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) ...@@ -1366,7 +1360,10 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
privptr->p_write_free_chain=p_this_ccw->next; privptr->p_write_free_chain=p_this_ccw->next;
p_this_ccw->next=NULL; p_this_ccw->next=NULL;
--privptr->write_free_count; /* -1 */ --privptr->write_free_count; /* -1 */
bytesInThisBuffer=len_of_data; if (len_of_data >= privptr->p_env->write_size)
bytesInThisBuffer = privptr->p_env->write_size;
else
bytesInThisBuffer = len_of_data;
memcpy( p_this_ccw->p_buffer,pDataAddress, bytesInThisBuffer); memcpy( p_this_ccw->p_buffer,pDataAddress, bytesInThisBuffer);
len_of_data-=bytesInThisBuffer; len_of_data-=bytesInThisBuffer;
pDataAddress+=(unsigned long)bytesInThisBuffer; pDataAddress+=(unsigned long)bytesInThisBuffer;
...@@ -2517,7 +2514,6 @@ unpack_read(struct net_device *dev ) ...@@ -2517,7 +2514,6 @@ unpack_read(struct net_device *dev )
p_dev = &privptr->channel[READ].cdev->dev; p_dev = &privptr->channel[READ].cdev->dev;
p_env = privptr->p_env; p_env = privptr->p_env;
p_this_ccw=privptr->p_read_active_first; p_this_ccw=privptr->p_read_active_first;
i=0;
while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) { while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) {
pack_off = 0; pack_off = 0;
p = 0; p = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment