Skip to content

Commit

Permalink
net: fec: no need to test for the return type of of_property_read_u32
Browse files Browse the repository at this point in the history
in case of error no need to set num_tx and num_rx = 1, because in case of error
these variables will remain unchanged by of_property_read_u32 ie 1 only

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Saurabh Sengar authored and David S. Miller committed Nov 24, 2015
1 parent 724fe69 commit 73b1c90
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3277,21 +3277,16 @@ static void
fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx)
{
struct device_node *np = pdev->dev.of_node;
int err;

*num_tx = *num_rx = 1;

if (!np || !of_device_is_available(np))
return;

/* parse the num of tx and rx queues */
err = of_property_read_u32(np, "fsl,num-tx-queues", num_tx);
if (err)
*num_tx = 1;
of_property_read_u32(np, "fsl,num-tx-queues", num_tx);

err = of_property_read_u32(np, "fsl,num-rx-queues", num_rx);
if (err)
*num_rx = 1;
of_property_read_u32(np, "fsl,num-rx-queues", num_rx);

if (*num_tx < 1 || *num_tx > FEC_ENET_MAX_TX_QS) {
dev_warn(&pdev->dev, "Invalid num_tx(=%d), fall back to 1\n",
Expand Down

0 comments on commit 73b1c90

Please sign in to comment.