Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp316793imm; Tue, 9 Oct 2018 18:53:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV6021V+UGuv0wRCR8pJi/KDT4rziIKakK719xXBb0QGGIU2ZjlQYB6mQRHTjnOhnHY5CV5BD X-Received: by 2002:a63:bf46:: with SMTP id i6-v6mr19538702pgo.378.1539136432067; Tue, 09 Oct 2018 18:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539136432; cv=none; d=google.com; s=arc-20160816; b=grtsRpUgfZjgEAS6rUzMR88LBXyuMDhZCku1Kyx340PzVL0NNdfAtU497AxJH/7VII r+EdX4ZFTIG9d94V8DahdfeDSole0qiNXuMNYoydCO5zgKmn5pTW5eLltxDJJSN0xrHG rcJ8nZOnenyE+bWu/Xw75lhVxUeWSaPizNxQNfUkJYInW9dh/RagOlAmQY58TD117b0J 1JEXsoYl7VqhrDQ/u/ma1z720xHQS68sbgFSEwflMirpG/a9+KNObM3ciZQEE9odDRQD aUSR9JvEz8f10MTpHCsObVnUhIgPjDkeodjg+dmaO7E6reQefXpsiBMWa1q78tI0aeAt 0zZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from; bh=TmjSxNQ0ZOO6zKHstqMRygfz5vs1Y7bxR2sjqouNxks=; b=EHmfajXnbu/CDLmxji1BYGqnNNLKcTwss8E2SxNCclhitFEpUe+kP/6id0aNwD5pl8 GLMkShK7ELQFAM1kwIj/fr7OOgP9Ri1iubnQjf/3IgFMwYTbn+7xG9k42sJawb5Otuht 3Z+b/GR+ue8M1n3FD+4YTyXgQxkhFosvQ/A4SyzX1KhAzlrzlbixutVskwzTC8qf4Blf fMLhNOVbdIXyU3G7Xo6q//PKkIQtK33iVUAkABP/MM9ciDT9txvrVcxBSlU85vDdK1Ng tIqTprQX/6fJk15a8Y98hYOiptwBNL9x/Iiir0wT6A8VezB9mR0FIIzwypX6R3injMJg +K8w== ARC-Authentication-Results: i=1; mx.google.com; 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 m23-v6si22672865pls.399.2018.10.09.18.53.36; Tue, 09 Oct 2018 18:53:52 -0700 (PDT) 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; 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 S1726925AbeJJJJI (ORCPT + 99 others); Wed, 10 Oct 2018 05:09:08 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:56655 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725955AbeJJJJI (ORCPT ); Wed, 10 Oct 2018 05:09:08 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 77CA7B00432A6; Wed, 10 Oct 2018 09:49:16 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Wed, 10 Oct 2018 09:49:07 +0800 From: Wei Yongjun To: Kishon Vijay Abraham I , "David S. Miller" , Quentin Schulz CC: Wei Yongjun , , , Subject: [PATCH -next] phy: phy-ocelot-serdes: fix return value check in serdes_probe() Date: Wed, 10 Oct 2018 02:00:24 +0000 Message-ID: <1539136824-44940-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of error, the function syscon_node_to_regmap() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 51f6b410fc22 ("phy: add driver for Microsemi Ocelot SerDes muxing") Signed-off-by: Wei Yongjun --- drivers/phy/mscc/phy-ocelot-serdes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c index 8936abd..b2be546 100644 --- a/drivers/phy/mscc/phy-ocelot-serdes.c +++ b/drivers/phy/mscc/phy-ocelot-serdes.c @@ -257,8 +257,8 @@ static int serdes_probe(struct platform_device *pdev) ctrl->dev = &pdev->dev; ctrl->regs = syscon_node_to_regmap(pdev->dev.parent->of_node); - if (!ctrl->regs) - return -ENODEV; + if (IS_ERR(ctrl->regs)) + return PTR_ERR(ctrl->regs); for (i = 0; i <= SERDES_MAX; i++) { ret = serdes_phy_create(ctrl, i, &ctrl->phys[i]);