Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6875713ybc; Thu, 28 Nov 2019 07:01:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzEe6IY0oEa0iVkXIim5o1eQI0HNENHKhONAm3qysVOmGeIkqvW3IIXR/GNjakJ9jxm4LCp X-Received: by 2002:a05:6402:2036:: with SMTP id ay22mr33383415edb.303.1574953267710; Thu, 28 Nov 2019 07:01:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574953267; cv=none; d=google.com; s=arc-20160816; b=gZHY2+bnX+f3cpOsEPt1W0T/iekoNbKCIjMeByd+AOXB8DcMWHQM6JO7EP2+0NCXef 96wbBH2N38JFdpvH4sO1+/q4y7qLN0z4nTMa2bbpYNZZqspwW+74imRBF46ltfKwhVS3 /PT1ENX/SJzpjtcZq30S1bznYtJbXHtyZ2pZ3hBhHSZkplpYeRDdvP7B8QA51sNFxca0 B3HdbQUUJA1aG3By1tDpF5aOgoW4EBwuZza5Emn2NiooR8pJF2FdmjhgIjMEaKLpf1ln LY4j4V+jIN+CNG21V5rvEGcs7HhbMUzOg9l7Hf65pvmlgmRpnD55WIg21VdesrhC0KrL j25g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LUyJI7Xtt6B49WNUawbgsGkfQ59e//4g+j9sie0K+wA=; b=inpQ3BJ86qhXeVs2M4bSl7BSdmDO9mk+NCQ/OolSBL4OuVCHSpRsSRbWKTV1ZxOINo Z/l1bdabiatdOFyth/wfdKX7gMznqcrJ1u4H2RP1/lf0XpmXmJtjAm5d85tAovNjgg89 KLZLalJZJBqDV/klZirRR7k2c8F/eMZvr+JBAY3omo1rRvpf5sgq489XElwYZ7Djt83b JckHBadoOdFTv8ElKI+yNHaxJFMdWs6NLIj+UqnQ3oooYbGkNgGaooQ2cwKvGzhcnOgW HP3HxkuPh7vmOEfJe5W/jBz13XcIHHUZJf7iSLJFbUabhf96XVZt5Yk7/vIj9Wb4gFah dGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=fr41RTJE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o26si5539267edv.420.2019.11.28.07.00.42; Thu, 28 Nov 2019 07:01:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=fr41RTJE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbfK1O6t (ORCPT + 99 others); Thu, 28 Nov 2019 09:58:49 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41929 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727567AbfK1O6F (ORCPT ); Thu, 28 Nov 2019 09:58:05 -0500 Received: by mail-lj1-f195.google.com with SMTP id m4so28806262ljj.8 for ; Thu, 28 Nov 2019 06:58:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LUyJI7Xtt6B49WNUawbgsGkfQ59e//4g+j9sie0K+wA=; b=fr41RTJEy5Zr1Mf34JJS2aTc0bRxU1MD9uDHZeMlDw2PpU5RYyFvfn9cfdKFgw7gRi 2EnpXvd2e2Fbq0fLk6r3nWUB2D3yhONTgOXuQ+LTEUIQ9ozzk2aJcS/eQhTFDmKhAnrJ enhP0jBLFcIMlhOAvq1jZL/fyPjFWIASW6ad0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LUyJI7Xtt6B49WNUawbgsGkfQ59e//4g+j9sie0K+wA=; b=SHo6dkztTr5y/+99gncc+cwltyZxHXKlY8Zd+lL50lhvamJyOJIUq8RC/9AcKQPrms amIbep5Ps4ER4tb6GrNto7+4/X3SBtFLXiltScgGZRItk+VJvc5zJZaLMF77nnWJ0evp aZboff6P50deElSG5AdlfX17JxepzHmax7n7yi2MThhlq4mFJ7b08G/ur3D7lxkZ2TpE gkIVm6Z1knKBlwKJ4aMK8KNOgiGboziGrtUsrMSXznUhRp7Zzb5VXy7Cv61OUkAsBSLo 6LJx+heng3qLosz7X2yAbL5nDTGoihHArPuE2OqDE3mTlRHFy3bq4ub+EhfxB9sxHCDz ZYDQ== X-Gm-Message-State: APjAAAVDcogy9tERc95dz1RkWiDmNfHcW5ZEJvI7BoNBINvAP9RZ8lQg VIbuI/d7/YpcnmK/yvZztz3yyTj/KKkE+vkB X-Received: by 2002:a2e:b5b8:: with SMTP id f24mr33942968ljn.188.1574953082288; Thu, 28 Nov 2019 06:58:02 -0800 (PST) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id u2sm2456803lfl.18.2019.11.28.06.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 06:58:01 -0800 (PST) From: Rasmus Villemoes To: Qiang Zhao , Li Yang , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Scott Wood , Timur Tabi , Rasmus Villemoes , netdev@vger.kernel.org Subject: [PATCH v6 44/49] net/wan/fsl_ucc_hdlc: avoid use of IS_ERR_VALUE() Date: Thu, 28 Nov 2019 15:55:49 +0100 Message-Id: <20191128145554.1297-45-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128145554.1297-1-linux@rasmusvillemoes.dk> References: <20191128145554.1297-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building this on a 64-bit platform gcc rightly warns that the error checking is broken (-ENOMEM stored in an u32 does not compare greater than (unsigned long)-MAX_ERRNO). Instead, now that qe_muram_alloc() returns s32, use that type to store the return value and use standard kernel style "ret < 0". Reviewed-by: Timur Tabi Signed-off-by: Rasmus Villemoes --- drivers/net/wan/fsl_ucc_hdlc.c | 10 +++++----- drivers/net/wan/fsl_ucc_hdlc.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index ce6af7d5380f..405b24a5a60d 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -84,8 +84,8 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) int ret, i; void *bd_buffer; dma_addr_t bd_dma_addr; - u32 riptr; - u32 tiptr; + s32 riptr; + s32 tiptr; u32 gumr; ut_info = priv->ut_info; @@ -195,7 +195,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 (IS_ERR_VALUE(priv->ucc_pram_offset)) { + if (priv->ucc_pram_offset < 0) { dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n"); ret = -ENOMEM; goto free_tx_bd; @@ -233,14 +233,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) /* Alloc riptr, tiptr */ riptr = qe_muram_alloc(32, 32); - if (IS_ERR_VALUE(riptr)) { + if (riptr < 0) { 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 (IS_ERR_VALUE(tiptr)) { + if (tiptr < 0) { dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n"); ret = -ENOMEM; goto free_riptr; diff --git a/drivers/net/wan/fsl_ucc_hdlc.h b/drivers/net/wan/fsl_ucc_hdlc.h index 8b3507ae1781..71d5ad0a7b98 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.h +++ b/drivers/net/wan/fsl_ucc_hdlc.h @@ -98,7 +98,7 @@ struct ucc_hdlc_private { unsigned short tx_ring_size; unsigned short rx_ring_size; - u32 ucc_pram_offset; + s32 ucc_pram_offset; unsigned short encoding; unsigned short parity; -- 2.23.0