Received: by 10.223.164.202 with SMTP id h10csp2366599wrb; Sun, 12 Nov 2017 07:40:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMYagCT2wdaKeCtG4Oc+DzL+WFsy7MW2YHXTh3YA23F6x0UJzogyw/bbwv0y8SGjCm3/x4xv X-Received: by 10.84.238.9 with SMTP id u9mr6543357plk.112.1510501206803; Sun, 12 Nov 2017 07:40:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510501206; cv=none; d=google.com; s=arc-20160816; b=OemwOkbqSS3UU4FqE7pA6Dp43Fk91yu8QZBWMVN8ofP51RO3vzhnS7yvfEvAt13Pou W8kj6x1k5NQRL3rgtY89+rlj0MDp/A+QHJVIm1rxL9gjXtf9aI5UzNAgpA4vMsXS+xgp mUvU1g8NS20gnFnsGdo4bRQK6b+OPDS1+fYpBKMz6Eh8bNvT0JPyJDF4bq4c2yX7ViXc kU9k2mgL16F4PHXg92BpraJ8fNyfp0wPZmBu4pC+35TkAZo2dfsMq9DAtVluvA6H9k6v 6gZJ+XPQiryLSJlW2pHrJXyAEdCac+7l0NKdlfQZkYiiFRAIkJxdzotAkjtp30c2Flsp /dUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=yT1lwYqY6YwtosCK+jDQgayN0m2qN8HXwrI5aOo3cI4=; b=ocSF0tGhqPnZ/Zi/nJrrmPtlECWzAaqTmU2tcNYGxYt7xRjzbROLl59GgCrt7SBLyj 15Wv6LBlhCRAZauSADZOQP2bXRsN5YDfXUlZRPXNPYG7d4LLuOel4/XtSoWvkduNQ2L7 jf+l7k6xQdcjhwyxWvuy6cG46hECTKcwYvkBR4Vcel4YsxyH0AcCtn4dDUMF0imuhglk oLzvfBAouxObCRJ+T0b53KiSqryUhe4LxALwdxc3hjBFgo0aeSnwS4q9xFJ61v9zAxYc H3Xe3NjiZR47VFhNSOwSW/MCevB73e/SwgP7g3VJ+/AsMj7mbPYCe58tVvA+DEvaB+rP KpUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=B2Lh7ivp; 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 k13si9925312pgo.739.2017.11.12.07.39.54; Sun, 12 Nov 2017 07:40:06 -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=@163.com header.s=s110527 header.b=B2Lh7ivp; 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 S1751591AbdKLPjH (ORCPT + 87 others); Sun, 12 Nov 2017 10:39:07 -0500 Received: from m12-11.163.com ([220.181.12.11]:53410 "EHLO m12-11.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdKLPjF (ORCPT ); Sun, 12 Nov 2017 10:39:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=yT1lwYqY6YwtosCK+j DQgayN0m2qN8HXwrI5aOo3cI4=; b=B2Lh7ivpKvsof/b3nkao+P7LCdzltpDyJn mEk6YIEUR1/piCu5ivsqo8xbctpubxealeVCHR2H/enI7nCDxT0l7eUhC9hv45Hc bsEARN1KxALfvnvselk6AukpYoy0uNbs+9CDSQ9ROvh/q7jNZKq0G12U78kQrToy PI/gBD2Es= Received: from localhost.localdomain (unknown [106.120.213.14]) by smtp7 (Coremail) with SMTP id C8CowAAHZSLoaghabC+OPg--.34414S3; Sun, 12 Nov 2017 23:38:23 +0800 (CST) From: Pan Bian To: Andrew Lunn , Vivien Didelot , Florian Fainelli Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Pan Bian Subject: [PATCH] net: dsa: lan9303: correctly check return value of devm_gpiod_get_optional Date: Sun, 12 Nov 2017 23:38:09 +0800 Message-Id: <1510501089-9451-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: C8CowAAHZSLoaghabC+OPg--.34414S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrurykZrW5Ar43CFW7GFyfJFb_yoW3ZFg_Ka 47Zrn7uw4Fk3W2kr1rWayfXryFyr95Wrs3Zay0qrZ3tr9rG3WUJrykZF13Jw1Duw4UZF90 kFn3uF4ru39rKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU09NVDUUUUU== X-Originating-IP: [106.120.213.14] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBzw+OclaDwDVxYwAAsO Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function devm_gpiod_get_optional() returns an ERR_PTR on failure. Its return value should not be validated by a NULL check. Instead, use IS_ERR. Signed-off-by: Pan Bian --- drivers/net/dsa/lan9303-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index b471413..6d3fc8f 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -828,7 +828,7 @@ static void lan9303_probe_reset_gpio(struct lan9303 *chip, chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset", GPIOD_OUT_LOW); - if (!chip->reset_gpio) { + if (IS_ERR(chip->reset_gpio)) { dev_dbg(chip->dev, "No reset GPIO defined\n"); return; } -- 1.9.1 From 1584081429508043212@xxx Tue Nov 14 22:16:14 +0000 2017 X-GM-THRID: 1584081429508043212 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread