Skip to content

Commit

Permalink
wan/fsl_ucc_hdlc: use IS_ERR_VALUE() to check return value of qe_mura…
Browse files Browse the repository at this point in the history
…m_alloc

qe_muram_alloc return a unsigned long integer,which should not
compared with zero. check it using IS_ERR_VALUE() to fix this.

Fixes: c19b6d2 ("drivers/net: support hdlc function for QE-UCC")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YueHaibing authored and David S. Miller committed Jul 23, 2018
1 parent 6a52581 commit fd800f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/wan/fsl_ucc_hdlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
priv->ucc_pram_offset = qe_muram_alloc(sizeof(struct ucc_hdlc_param),
ALIGNMENT_OF_UCC_HDLC_PRAM);

if (priv->ucc_pram_offset < 0) {
if (IS_ERR_VALUE(priv->ucc_pram_offset)) {
dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n");
ret = -ENOMEM;
goto free_tx_bd;
Expand Down Expand Up @@ -230,14 +230,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)

/* Alloc riptr, tiptr */
riptr = qe_muram_alloc(32, 32);
if (riptr < 0) {
if (IS_ERR_VALUE(riptr)) {
dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n");
ret = -ENOMEM;
goto free_tx_skbuff;
}

tiptr = qe_muram_alloc(32, 32);
if (tiptr < 0) {
if (IS_ERR_VALUE(tiptr)) {
dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n");
ret = -ENOMEM;
goto free_riptr;
Expand Down

0 comments on commit fd800f6

Please sign in to comment.