Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4596923pxj; Wed, 12 May 2021 08:57:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykr+jS6PPa8L1LQEqEmfgc8xrPX2vCRoHlwn5Kk+77CytJgoOl8cQwd9i7hiqHjMniuaFc X-Received: by 2002:a05:6402:4383:: with SMTP id o3mr44185168edc.333.1620835029589; Wed, 12 May 2021 08:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835029; cv=none; d=google.com; s=arc-20160816; b=048MwKpbwaXD3XqAOax9q5wtBCsv6lUjANMXI79Wxny6KoThREyl5ao1TAgiGn80rG X/K6YqiOOjh6ZouWH6tjcj82qc9JTh0ELiwClLrWowqXJ4oOsIMvfGk3UCBapdiI3+a7 jDcSWkCj39x6t8KDp+GuQA27UBb0ra9gUiduc2utREhfDwDc1sRssLDojGtdRGMe+4t9 /V02HT1mIMwGMiQtY2LcxZEqbEX1LOWBXjASiwq5WfU6aRV3RgXsEVKd/ekcZgu0haIy BJFqCV0UuNF0tjziM/VRkN+MIQJOtQYeA61H12UjUg13qKMOlQMUlYrepXN8aiCKhoDa uaKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cLrw2OmKEViH49RmePPDrBNaDGsYuBH7Qmgeslwgcpw=; b=STZSttdnljUl6FtEJROqRRk4ew95AoQrVY539C+QKK1qa2bPgMAo60mU684LYOi+ME 5it4hp481g6fzYKH5fTsxIXCn8Fh+z+9oMQVTkkZGahFQfUjQwOAFv0F5PNqQeA6TC/U tA75opxpFw9DLyM224vh/ZPrDGYF0NnoRZoHZ5C3uBJgrLevLd3Isi2BG0ItZk6EvXIj 20EtDJWDHsHt82B6pM+7xXnENznJittGgUUc7jFnnahNr756FIFc7eHOonSiqz0t0KE1 fKgwE5936lIKDXZ7+FVhjf7TQgp4Xv7SPAIe3bSX8hyxYfypTLvhFr7GrumekevbJvMR v2Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u8YwAFmu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ia21si290160ejc.441.2021.05.12.08.56.39; Wed, 12 May 2021 08:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u8YwAFmu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237035AbhELPr5 (ORCPT + 99 others); Wed, 12 May 2021 11:47:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:60626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbhELPWW (ORCPT ); Wed, 12 May 2021 11:22:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5367961966; Wed, 12 May 2021 15:09:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832148; bh=ZnaCbQXZlGO59K2ocfYHQFO6X6jHkl4oWlg5s3IID7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8YwAFmuOlchok37RKnI/BBYZbXBTOZ/8DsCWftLZsp/kVqODaKOPa6aoMGuTWiee 7Xn5lm4FLuWRfdf7mEFC84omB3Ziq3DSwXyFG0SvcKqaDosX3HqMPeMi4R4WqJiuh9 noXSfY2FrbiKHF0WdBo8usRmh6WSIdoEkBxTjYps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Heikki Krogerus , Wei Yongjun , Sasha Levin Subject: [PATCH 5.10 144/530] usb: typec: tps6598x: Fix return value check in tps6598x_probe() Date: Wed, 12 May 2021 16:44:14 +0200 Message-Id: <20210512144824.558445336@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Yongjun [ Upstream commit 604c75893a01c8a3b5bd6dac55535963cd44c3f5 ] In case of error, the function device_get_named_child_node() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 18a6c866bb19 ("usb: typec: tps6598x: Add USB role switching logic") Reported-by: Hulk Robot Reviewed-by: Heikki Krogerus Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20210308094841.3587751-1-weiyongjun1@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/tps6598x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c index d8e4594fe009..30bfc314b743 100644 --- a/drivers/usb/typec/tps6598x.c +++ b/drivers/usb/typec/tps6598x.c @@ -515,8 +515,8 @@ static int tps6598x_probe(struct i2c_client *client) return ret; fwnode = device_get_named_child_node(&client->dev, "connector"); - if (IS_ERR(fwnode)) - return PTR_ERR(fwnode); + if (!fwnode) + return -ENODEV; tps->role_sw = fwnode_usb_role_switch_get(fwnode); if (IS_ERR(tps->role_sw)) { -- 2.30.2