From patchwork Sat Aug 6 01:01:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9266065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFACB60760 for ; Sat, 6 Aug 2016 21:33:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE6A628333 for ; Sat, 6 Aug 2016 21:33:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EF7327FAC; Sat, 6 Aug 2016 21:33:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B13E28333 for ; Sat, 6 Aug 2016 21:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751056AbcHFVdH (ORCPT ); Sat, 6 Aug 2016 17:33:07 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34789 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbcHFVdG (ORCPT ); Sat, 6 Aug 2016 17:33:06 -0400 Received: by mail-pa0-f66.google.com with SMTP id hh10so21421312pac.1 for ; Sat, 06 Aug 2016 14:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TXTinXg+G2kv0cPKHhfEkUsXnsta9/ED37ygBdwxpRY=; b=OJtQpmmNNGzNSxJC8xtooADm4bUHTyBOIQH0pzKIRjZ/BIL2t8/RHJoMSKBZG16U2h i8HLqoYRyQs7cv8DPj/0xuZ7KN0zgMfTwQcm5jyZL7MRC49LQiGLY1dCVAgbdfbf3W3f R0X+uxKO833Nj//080oKN/pdajc0mA2p+8iGDF88Iz1JMhQGI/QUWWBpzZ1Sy3T5KgQu Nv2QMmETdPQ7/aurjQmatzX5iXsaZJVdIeO1VmxMqjcSrDqeu9lqGYkGZ4w6e6YuMGQZ Sn/sdnal1/qOVWEEGAKf4AChUE/jvGFCEd2SddDxiBXzB78+U2LkZughi6dz6tXBhK1T WEOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TXTinXg+G2kv0cPKHhfEkUsXnsta9/ED37ygBdwxpRY=; b=M89uW5To1VKdXJIkT6q3R025GAfZBxTx8xYqBaKX3qLJHrYRLakiUk7k07DkOqHzBK xgl6Z6+Ep1C6q+b1ayFJY+2psOCor8INCGekUke/hFN7kY5d1y3ZZ1+fHr8zVb1UzwFy psIt333tXW6y7y/Zb88FKtIgQKXdZ+M+Ly3I8yHxwaNKM1iWeJfd1fd7ooY7KAgl5vy3 OFyBfeJQPMPLAbt4T0o+181GPyz7+ivbgztC6AH+aU6r4q1ydqDyABDm7syaR9sVSKPC P6lft/iOOu1pDllW3kdVEQ2SP9EUgXK2NW2WEppWJh30XDf4LWSav5XgeEWEFxdHJuFP Rt3g== X-Gm-Message-State: AEkoousGQA1Gz2Qnz8t+xrwm13YHvRS0gB22D6UkAlCSCLYBseXJ341vCGVZHPc/vnZzdA== X-Received: by 10.66.219.105 with SMTP id pn9mr139449056pac.25.1470445291267; Fri, 05 Aug 2016 18:01:31 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id h1sm30670197pay.48.2016.08.05.18.01.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 18:01:30 -0700 (PDT) From: Wei Yongjun To: Lijun Ou , "Wei Hu(Xavier)" , Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Wei Yongjun , linux-rdma@vger.kernel.org Subject: [PATCH -next] IB/hns: Fix return value check in hns_roce_get_cfg() Date: Sat, 6 Aug 2016 01:01:24 +0000 Message-Id: <1470445284-28970-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun --- drivers/infiniband/hw/hns/hns_roce_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 5b42ec8..6ead671 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -715,8 +715,8 @@ static int hns_roce_get_cfg(struct hns_roce_dev *hr_dev) res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0); hr_dev->reg_base = devm_ioremap_resource(dev, res); - if (!hr_dev->reg_base) - return -ENOMEM; + if (IS_ERR(hr_dev->reg_base)) + return PTR_ERR(hr_dev->reg_base); for (i = 0; i < HNS_ROCE_MAX_PORTS; i++) { net_node = of_parse_phandle(np, "eth-handle", i);