From patchwork Fri Jul 22 08:18:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Ji X-Patchwork-Id: 592785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC181C433EF for ; Fri, 22 Jul 2022 08:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234816AbiGVISx (ORCPT ); Fri, 22 Jul 2022 04:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiGVISw (ORCPT ); Fri, 22 Jul 2022 04:18:52 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507CF9DEE3; Fri, 22 Jul 2022 01:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEfUgRt92qzWAbF5kdguedH1w1THpTacr77TB/bfi5JNaDv/hJxeHJTC3l5507L/M+eGBjcQX/JXSI96BXL0K7oR7Zo4Dw8mBED71NMr3Gn3O+Kqyey1t4Y2rLEyA629yn0P5tWKwBmjLv8kyvwrqHrNvawZ0dSxNF1DI4+h59MPUBhVU7ec9YKQ4/rjXAI+q6Qenz7qTsCRFLNtlqFxjwPSGkIaj3Fw+Qynl5qoN+DsCMOjktUX3F1SO5+URi9haPRpBikSn/jYktT6E0CWut240rkiD2ugvTzw4jzpLnp21ERUx70fKjlh0MRXTOSPUURNMIXa4NsTH1OZMFDljQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PII8ZTfTSFW1bBpp4hMzebR9TmVODZU7ENQ4BBYEwW8=; b=Axe3Hkjwww9z3LxqVaam52EFnFeOKV+uGbzt76G2uxepIy59R0OxZ6mT06VIMKWvQICK8zijHP4SnH8deSYJrSo3SeTTsaCLRA/4zYcBEURuopvBSmR0Yd4vHLRZpmwY72KgvF587taG0g7j1s4AUxHx25Q5IKdOEsirrNxbBLw9ivucT49ThX0yp78Un0emSk+qb378HRUSyVCl8B6tEgY1RFWqGvWcY+p5ZweegT3B+RohhnF2rp6RIy9xsvIpPrnM+HS+GoV0HkwRbRYQnr5OXxzPgqyPwQ11PSN+A9e/YsVArMEm0+9tfL7xlq/26yHJ/JiR6rfwcbR3++ZYKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=analogixsemi.com; dmarc=pass action=none header.from=analogixsemi.com; dkim=pass header.d=analogixsemi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Analogixsemi.onmicrosoft.com; s=selector2-Analogixsemi-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PII8ZTfTSFW1bBpp4hMzebR9TmVODZU7ENQ4BBYEwW8=; b=oJ2hh3SN4z/Txfd21VWW2WznAbtzzSx9w1pCYB9Q3KE+geGXBMJW5qIOgTmtZydYeztdTm4OL6d4R7RE5zLl6k+TdLkUzR4rK88WmY3iNPVgkyLBQIObjTJ3jVsIhgWRYjeSVVcmGSsEe9tJOo28Srgkk2yBUtSrzKY+4y3GBAs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=analogixsemi.com; Received: from BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) by BN8PR04MB5986.namprd04.prod.outlook.com (2603:10b6:408:57::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 22 Jul 2022 08:18:48 +0000 Received: from BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::f02d:f2e:cba9:223b]) by BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::f02d:f2e:cba9:223b%6]) with mapi id 15.20.5458.018; Fri, 22 Jul 2022 08:18:48 +0000 From: Xin Ji To: Heikki Krogerus , Greg Kroah-Hartman , Xin Ji Cc: bliang@analogixsemi.com, qwen@analogixsemi.com, jli@analogixsemi.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] usb: typec: anx7411: fix passing zero to 'PTR_ERR' Date: Fri, 22 Jul 2022 16:18:34 +0800 Message-Id: <20220722081836.3380885-1-xji@analogixsemi.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: TYWP286CA0025.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:262::13) To BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51444700-8089-4749-1bf5-08da6bbacda1 X-MS-TrafficTypeDiagnostic: BN8PR04MB5986:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2WMzWBUJbX3YzhiQpofiQGmw4oDeLJVffHrfREL6+DcUJ0RZX8tbPQ3OZonSm+FYP9oQG9d1Wmsf3AGCAnEKsVD24dGF+qasqMI/8IIph2t6oI6DrNuq0t8wkBsBh41jRgxVLCJClNHhjYdBx3WyfnxEL6dwMYqiizdxT5ZXNSwE58wn4GEyEbDXfcivUV4LG6uH+uwPUyWVblINeY1Vd+j7Yb87a0ovuw4euSEME4nlczFOpmbSaW+A/vfLN2OA9fulRfvLFieh6kxnrTBG824gR/VWqVT5oDII6pk082JdFOZuyXgGxRbNkgddTWchKfLue+G4rRb9mHLLuFdgYsrdsLV2AksaD2b33ogOQm6sSVhxz1ETE31KEOjACRDFnGUhIcBFuNmoSn4XmgmVTVmnUWj7pzmRvLBg4vJ/yKJj14blhlaJ4ZQBrQGNHeoS1b/JHWLxk22TYRU3JpSaP2Ta/GCoDqfBAWo9Rf7sDVgYuUOBr4gVHSiJIFiQ0oNOZdOfIrx7Izc9OxJI7A8bMaZpYYO0vAtgxiqWLZKPhvlU5COjAPfjhg9b4xJhYiSFPbRza4gRxny8wdsoK1XiXP2IM2juf4Sgn2dcpElMpCy8Y+ulRQjpP4fCEgjgMqQmwOS55Bxi4gkfT5WfCmkYMB+HeCgt4f5TJN4UtKWvVFyUfkJfzh3wBSCTPz1+2W0OfmAlS6AETji9Qo5ASnlVZ/t1s0e5nO+APusea0nqMsbwql0Wg1xy/OV0Uz8B3uXDyB6+9UbSxGIIFKsJb4xCo19CJ0XSiMVsRSxBA05ECg8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR04MB6739.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(376002)(346002)(39840400004)(366004)(396003)(4326008)(8676002)(66476007)(66556008)(83380400001)(7049001)(66946007)(6512007)(41300700001)(6666004)(2906002)(26005)(478600001)(8936002)(5660300002)(6506007)(86362001)(52116002)(6486002)(38350700002)(38100700002)(110136005)(186003)(36756003)(316002)(2616005)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U8x8+7gDKBUVQPhvRRnIh+/G0nQJXfWjCiMXZsa0mglyFpjrZbGAGukAVPM9EG4Mvqkbc4A6azIkzbGhVgLLe70AU5Qmj63iVwrm+QO9LYzfKpJVR9lMRUOesRNIBa8EU8XSUGhpXMk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XzvN4mLqHXJi25u39QkLY9970PCNfrsaGlxZQIAej6J5V7Wr6GnjasoAjLWfm3GXrpofcSps6VT219h0uM5FP5GPTvEb+C6ERTUSdvhn02jeTdzmCnn6DOZVRhmevX47eJ73ytQ8bHVSXIb7BzvatjL6+7fg7//EWMwzWKY6jrL/CBjEWczKopA3LdaCQRFN88u7y6U/9TF6+j+xqIqJIF9598MXQpS0fzRYIcraePx+qi/W/38hOjp0ubHtydme66JZHPGEq82YTzHZ4DCXZIc3O33SUM2Q25HC9NxN9Y5DS6StfWUoAOM0bydhA2/YSoVW5yP5Qm7rGBbuK/4o6RbstR607FSXLLFnh/u3ILvBs9vLoa94mlSpq/GcQ+MFP4W94 X-OriginatorOrg: analogixsemi.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51444700-8089-4749-1bf5-08da6bbacda1 X-MS-Exchange-CrossTenant-AuthSource: BY5PR04MB6739.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 08:18:48.6198 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b099b0b4-f26c-4cf5-9a0f-d5be9acab205 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: go6vw5LucQ2GynlV8c4MQkMsPyf2+437A60aJ5JPa7egkz8QcM7MZzQ0N749uvz3+P8AaH0E7XA3FAUMgVWFXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR04MB5986 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix anx7411_register_partner() warn: passing zero to 'PTR_ERR' Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support") Signed-off-by: Xin Ji --- drivers/usb/typec/anx7411.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index b990376991f8..7b45d7440a9d 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -374,6 +374,7 @@ static int anx7411_register_partner(struct anx7411_data *ctx, int pd, int accessory) { struct typec_partner_desc desc; + struct typec_partner *partner; if (ctx->typec.partner) return 0; @@ -381,11 +382,11 @@ static int anx7411_register_partner(struct anx7411_data *ctx, desc.usb_pd = pd; desc.accessory = accessory; desc.identity = NULL; - ctx->typec.partner = typec_register_partner(ctx->typec.port, &desc); - if (IS_ERR(ctx->typec.partner)) { - ctx->typec.partner = NULL; - return PTR_ERR(ctx->typec.partner); - } + partner = typec_register_partner(ctx->typec.port, &desc); + if (IS_ERR(partner)) + return PTR_ERR(partner); + + ctx->typec.partner = partner; return 0; } From patchwork Fri Jul 22 08:18:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Ji X-Patchwork-Id: 592784 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31E29C43334 for ; Fri, 22 Jul 2022 08:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234925AbiGVIVG (ORCPT ); Fri, 22 Jul 2022 04:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234866AbiGVITH (ORCPT ); Fri, 22 Jul 2022 04:19:07 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 299BB9DECE; Fri, 22 Jul 2022 01:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RPYCRQ4lVxw+KlN/zZi7u59i0f/Kkz9XWwuI1/AhO3HwvM25PcymxttEbyWsBqkzLxjsZbgLhcxMolZBYS/UsPozdOf826JmOyCcTcB9ogNVCVE3RafziJoKgluc3mNQRY5zExKfUAX+TDtSZ076VhZ/BjkiPT43VkgQFpGy/NRljcqCTaFAqvjyCUEjm3q0vEg+Lk5DbtEpITH7VOtsGA+NO9HiZUuHTgWZ9N9ZzeVbpLW4mV82wSTsbCznuU+yYudf/2RIyIvz+xfKx9nEaUGX+ST6Sbvjb4i07F+AXEDb3TlUwXKmaGqTST+v5kxJTdYEHyC9RtANvMXP/VmDvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ih81gXhpcBE25HgKgIdRF7m1ER45A2lSMIcjEJ8W/ko=; b=DPnwf1zfk0xL3VJio70/lBMYaLD+2z0NsDyHQN3nUQbw0vMw0mnf93rWk2JUktRx+sfsTL68BOczfn/HnnOhCziZjzzL5MDncrgcl3VSinkhbI1NvwA3W81mPuk+nlKnw/gjmE9aQTYaXhSXtOePQNX08ayfKCIQ1+b7scyW07vn3vFFNigRvQ+SjjpKCi3ICuhSW31T3U3nzb21cHf61rXDFBrMGePkBBVJjBuwamCQXaYWjXe+URU2XXekq7rsnxJHyRzkpKGZGnBvcPgFq4xOG6DZO2NUD7haFoDoDcq8NjNeyOpBVWoAmVPO4RRViW3c4y7BVn5YFYkHxUUXVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=analogixsemi.com; dmarc=pass action=none header.from=analogixsemi.com; dkim=pass header.d=analogixsemi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Analogixsemi.onmicrosoft.com; s=selector2-Analogixsemi-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ih81gXhpcBE25HgKgIdRF7m1ER45A2lSMIcjEJ8W/ko=; b=mdu0zWQsh1dhkOb7YGS6woix+evsKrrZSkBo9byhMKDQIunGBN+p0VGJPFKBaZBkzKavhTXGftAUuyseKi2ZCuvznXA5JZ1YufodiqqQpoqB0BlJzXVFkZ3E+hb2NAh6QAHcJN6/j5S/wwbcbKwLbnv50QiU2PhtbXbG/xr2TfE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=analogixsemi.com; Received: from BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) by BN8PR04MB5986.namprd04.prod.outlook.com (2603:10b6:408:57::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 22 Jul 2022 08:19:05 +0000 Received: from BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::f02d:f2e:cba9:223b]) by BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::f02d:f2e:cba9:223b%6]) with mapi id 15.20.5458.018; Fri, 22 Jul 2022 08:19:05 +0000 From: Xin Ji To: Heikki Krogerus , Greg Kroah-Hartman , Xin Ji Cc: bliang@analogixsemi.com, qwen@analogixsemi.com, jli@analogixsemi.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] usb: typec: anx7411: fix passing a valid pointer to 'PTR_ERR' Date: Fri, 22 Jul 2022 16:18:35 +0800 Message-Id: <20220722081836.3380885-2-xji@analogixsemi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722081836.3380885-1-xji@analogixsemi.com> References: <20220722081836.3380885-1-xji@analogixsemi.com> X-ClientProxiedBy: TYCPR01CA0077.jpnprd01.prod.outlook.com (2603:1096:405:3::17) To BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3445ade-6bb9-4473-dd9f-08da6bbad78a X-MS-TrafficTypeDiagnostic: BN8PR04MB5986:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ikeF5oFCPAXilsQ+VqYQS6t97KZc960+b+e7aKw5mPOeGErnvgp9m4kYAvahbOan3neFgaSWfViE9wzV0CZO7lpnx4+edEqlMMy9OEIWQXisRvzOLNBCRoQzPRK4z17p01d0AbTxHNUmQ+m5AIDAI4vfCXEjl91rmS4rfktUTcccpWUF4F84rjhg771iMSJ+asGm56OxHrfyBPoRN++JJXYYZNhMaFMYVqMExifCeHrobknnBbML+sVaEZgNMTGbQFUiE9K+0pqXYnWOHiw+FhUpak/qtTXrLTktkCVQh6feygXFyCinmwCCPet07wLwI0CJWlITBl0eAadtTpu8svVYI6lITJy+gcQ+nvveZX7E83ekE/TeKntNcPlaDap+37PDixTq0UAnsIm/xIFK+D2RpkcXVlJwOueRgT0qTn8cFmjs+qt7N11ZwwN8n9nE2/VYSu5rTKitwmvNc8ESvVzY2+1bN7Mb4+UI9/rEnI/QdaZ4MC0lSSdTrrwGRzdenUM2o5ln0d82Cw75O4QEheUZOLN04pn994hCOmVkB4CXaIzgIVLAa4qEn8bBppTsqrJwlHC7zDaHA3+901hyYTinsX2UKOtbjQOr64FV4LwlfKYceOVScly1lu+6wmAI6HumblQDqrv3DwSszUW2268fQo+8lg9/SEdhz1BT72RBJTkKviX5+Iti2ph08fwBBsyYdlvl3sN4ctqu5Ii8z55syGqe6/kOI560Bj0FXv4v3DRQHxmj6+Z2rkdTtORkjCaifsruRrHBlXU3j5KXyIx9NHIwT3RD7YomKTdIivU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR04MB6739.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(376002)(346002)(39840400004)(366004)(396003)(4326008)(8676002)(66476007)(66556008)(83380400001)(7049001)(66946007)(6512007)(41300700001)(6666004)(2906002)(26005)(478600001)(8936002)(5660300002)(6506007)(86362001)(52116002)(6486002)(38350700002)(38100700002)(110136005)(186003)(36756003)(316002)(2616005)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fS4SsYNRFzmx6wDrmqWDPkPNdzrXIwLXpmNOXCFdlGNujMR3/1tYWjoLyp8a/ZUVMXDJKhoFrTp4Jer2koqt1oFglolskLoN5C4EaCma1eA7lnipdzKTtIny2dIi0w3FPLB/FF0h9j6iWDiM1MyEekB9zF68pp7mWUCHJWNC11cs7G1ua4i7DOoZk5V6/97WeBivv+LMIfcsIKCEUqxf//Ep7Afa7qh5ZjzShio6RijEaQrM8CWeune8LpGrhwA76W9Qb1aUjqRkR4fwWp1itKKRvCXEmhtf3CUAXI/Fy9B1t8Lg+YTlr6t2Y7w4Q3Jjp1i2eOrbuhx5rH+OtUQzq2XLIUDZ8P0rv1dN8HL5LpQCYaDebwKfhxuec3ce6NanV+sWCSEElwE3zgoFJumaTejtp8xxdTC0SNmiSjap9/DdbFGxcE8cob4WYsvvEABw81KSVc++ehJ0DmorreD7YAz3/leoy+XwU4kdxPhrzJtB36GBDYjaBextvg6YNFf7qiM/nQnaHaEYhQSfm02R7Gn3IAbWc7QuFfS/UXKhpA3dYpiSZMtDoBN7pGw3Ek+FE3poaAqbnLGj9I8O6Mb1nkYmQuUX523TSP0hM/PAn8lewmMljngTy3sOv8k9wZa4pCmY4Sech7M3+jcUa+kL8Re5UAt5lvGVfEP5x9ME/GrdvUtB9hiziP4KpEBoB1E0o8aoj4MA2BuCViTqHCjnjEqhOGYhiEOEYRqJ6ZGgbLml4dGDpJc0VRtM3jTqLEEUxeBv1Ya/pbnxHGH+2tTtTXfDkrD7x+94Rj+9jpFV2iwE4JRCvV/8qS5RLv4llUyxmS3DWOcvbqZbz++Abdw9aHRs7dWD9LeQn6XqRSwz+Z2JAD80vB8ugKkPFHS6+W/OG7YNWCpQMWulxmCy3nEZNmLYhE0s2FjqkqwjgIuiOWaX5yohi4EhZvOKjQ/SRZDHDp9pMpAe+XdLcjBmIsWKlvzR4OFnABMo5CNenlZwX7HGNRcsx0CauC2qVKBqHo4n1Cjxk297bmAwY8a9Y4p0xSCagpXBQh96e995s+8aEqrQuwfBnLHrvyYY6B7fDKMbBovSQUhxPsJGvb8r5bzWpXOUmP3d/+hcBe7p+gTIpbZSkyCfDodU6DPztBGIsRYEKg9Prnzw5vTV1uUQapudBmNhlJ+BjGLccSjc7IljXDKVXb1TMyvSPRTwXBkIe5x8ZfIIEa9ldEVvZzIvSilEQzkhx9i+QMpTo9ZULW/H+9psGCkiZYAgMs2LLqOsRI/sUlcZvjRDPF9Gnw7jNCEAk3dVHsA54vamKcdoJbyF9th1QTGBeOlopDkmlFF87qIeP4cMtKIwDbxnF/k0XHWWHb/mWx78Elf/Q2w3sW/2seu36JhR7qhvvLaFEnPOT0Gyj1S0vzSbK4ycH1s/YGB2UKEk2Ev7JvWyyg0IiNEaZ3bZHBe73EkxzovGRD9ErBvGHvrPtDmomWJVJFLsFJokjrrfxxp809kaaRPJiFXkzh9m3I7cB47qniivYMd9zuMCyVlxrEEvFO+bgJohGXAzDXkg4aj3uyLw+vHVccDJMboTt8l2CwS2pIGrg7zUwFgR X-OriginatorOrg: analogixsemi.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3445ade-6bb9-4473-dd9f-08da6bbad78a X-MS-Exchange-CrossTenant-AuthSource: BY5PR04MB6739.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 08:19:05.4219 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b099b0b4-f26c-4cf5-9a0f-d5be9acab205 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t06QwyIyPH2KyKBUPh7Zc0/lnKFGwJyGRbtApYI8TUl33vhLRdxwtvUHGJ6f7YWiLJ2hAeIYJmQkxlHDbTOHcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR04MB5986 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix anx7411_typec_register_altmode() warn: passing a valid pointer to 'PTR_ERR'. Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support") Signed-off-by: Xin Ji --- drivers/usb/typec/anx7411.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index 7b45d7440a9d..dc86b6704cbd 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -550,6 +550,7 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx, { struct device *dev = &ctx->spi_client->dev; struct typec_altmode_desc desc; + struct typec_altmode *alt; int i; desc.svid = svid; @@ -566,14 +567,14 @@ static int anx7411_typec_register_altmode(struct anx7411_data *ctx, return -ENOMEM; } - ctx->typec.amode[i] = typec_partner_register_altmode(ctx->typec.partner, - &desc); - if (IS_ERR(ctx->typec.amode[i])) { + alt = typec_partner_register_altmode(ctx->typec.partner, &desc); + if (IS_ERR(alt)) { dev_err(dev, "failed to register altmode\n"); - ctx->typec.amode[i] = NULL; - return PTR_ERR(ctx->typec.amode); + return PTR_ERR(alt); } + ctx->typec.amode[i] = alt; + return 0; } From patchwork Fri Jul 22 08:18:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Ji X-Patchwork-Id: 593252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1060C43334 for ; Fri, 22 Jul 2022 08:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234826AbiGVITQ (ORCPT ); Fri, 22 Jul 2022 04:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiGVITP (ORCPT ); Fri, 22 Jul 2022 04:19:15 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F9A9DEE6; Fri, 22 Jul 2022 01:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OkHM8Uk96sHCeBgRgb99ccz0Bd0V/r5GBkTUflo2oLpKItk/WqTCV+xh3Qu0HmJACjeSYxEQ8HJP9pU0D/REF3CV3TaCkgg7/UMqtijjuuN6UvnlbaKv0xgPWRDT9ZlXorwiylXjCmZ5gFvjwSeL9TkGUG2T03SOGZJw8S5j092gS6vWqX/epVk5A/CN6VlxvFWxCkmCZDsDsQY7yA7qDy7L6yhDv+V7kPxW3EdYGau8E+Dg7qhNCgwnW7YZDFMeLWCBAE+shK13NLuR2z1hwW8AMaSiMM4wuMTsroMviP4SdydQXYeC65umZorZt2omGE1kq/MMvK2Ee3U80ukz5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DJF3NB6jgHIABUR079P15okPbHbjcE2F71rF1xFXYBw=; b=DUlqBJjDMnPbzIVaBNFy4f1wAA97AEyhiNldm0DZAQKV5deTqvvU729PHdhSLXZSEL8+BBDoEurzcE9YEtK0Nrm6OJpSCxjL1FU14EvCsUiQ2M/J/FrTYtmTrvJIUw8rFm2sYaic0+3TqEjMO3aBUyda6XOd3waJy+v3OLJneZJwwvp2VSKeY610+Sp8w7ZMOA3RDP1C5EfeWrhI5u4V9I4qgOvIJCB5lT4okYP0tcs0Xlk4l6i+pHCH/Gb5n9dbeFosf4zsrY+HZlveuO1x1VzLJJVFsNA+ZF5Q7Tjd9JWarLhqGSZ2k6p17Nejci0Nruo8QZ9ej9r9YZjSZyvVFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=analogixsemi.com; dmarc=pass action=none header.from=analogixsemi.com; dkim=pass header.d=analogixsemi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Analogixsemi.onmicrosoft.com; s=selector2-Analogixsemi-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DJF3NB6jgHIABUR079P15okPbHbjcE2F71rF1xFXYBw=; b=08Os6o/2dwRhVE3jDFB8mxrwWtzrvpa9Z+nk1k9wmSoDzSHj5Xk4BdrkYW4APHGXf+P1wsxi3E3ytuQzgPKXf1ugjW8Vfa4FXg6nYcC6IoqpH43TTuGtpqhakcQ1rjBtHP8KNBy0wjSjTdGYpfuaWPlTZ4eB7dyiyj+CWkVB9e8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=analogixsemi.com; Received: from BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) by BN8PR04MB5986.namprd04.prod.outlook.com (2603:10b6:408:57::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 22 Jul 2022 08:19:13 +0000 Received: from BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::f02d:f2e:cba9:223b]) by BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::f02d:f2e:cba9:223b%6]) with mapi id 15.20.5458.018; Fri, 22 Jul 2022 08:19:13 +0000 From: Xin Ji To: Heikki Krogerus , Greg Kroah-Hartman , Xin Ji Cc: bliang@analogixsemi.com, qwen@analogixsemi.com, jli@analogixsemi.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] usb: typec: anx7411: fix missing error code 'ret' Date: Fri, 22 Jul 2022 16:18:36 +0800 Message-Id: <20220722081836.3380885-3-xji@analogixsemi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722081836.3380885-1-xji@analogixsemi.com> References: <20220722081836.3380885-1-xji@analogixsemi.com> X-ClientProxiedBy: TY2PR06CA0013.apcprd06.prod.outlook.com (2603:1096:404:42::25) To BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d38d6fa-5102-4b74-87fe-08da6bbadc41 X-MS-TrafficTypeDiagnostic: BN8PR04MB5986:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2qYrKNPsU8NjtK6X3UQn98Und1tEVtwoYUY2/0k4tlTOQgeRKLfez1Wmyc1CH8wK9U2kKlEwdNf2ZgGGRUa69+EZlF9sb+nOgztfMM371HYGiDxlZk+hBzVzyCoNYRhzVcKhK0vx2OTstnduMtCtX6dE8em5D6MP3n865894H+uIL/I8LAevxezOmR7RG7WGOhQYttlKGT7kn3CPUN12Nn1ySvercgFRV90PNfdRMcfOEkGNLQni2xANUOouTCoYrjYuy+vLniVG5rzO8Bto0wx2dLpkxeeM0URY2vj9sGh0KzKN6PPWnPFEfcP3Jvy590HM9KK0OOIfDGefxScSslzSWL+ivyUQJK2s8gG0kFyu8SVqU1dTN1KcHqo0vTvE8cTxloW+eAx1hi3QCcV0aWLm4/gfSpgXjgR2M3w6sUEvVChEUpeDTwG4h8rfcFO/hxcNtDmWi/TUiaK48BTxFWsqC4QtXNDxGTPvHztkBx/SwIBfcldaGCgyQYB9M5rUOMtTJ5XFB28h4DwhS7ucQxrJUqjYA8uM1HSrnMqSu1Q+WlTxgiqf0V0XcFZwqbWU8dRphiLGZucoHfBUxWCvE3v8JeENGoKzAe9o/ilhryNduP3uZCB8TFxwNEnIn0aYGwm/kknm16DUjAaxSVYD9uOSC3uU2VgwPLY/Pbe3l+Our4KoQaG7QZMTrc1xwWHHtWqeRJWKPbftolRXghodxw7RPyqMJDOXExVM677VBBeI+1quhxLakUUJsbI248mzapbhFADcevxKnmMoL01pKA4p6JHZIg3ThH7hiMW0cNGaNOkDeYnt2fqkP/vAVe1g X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR04MB6739.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(376002)(346002)(39840400004)(366004)(396003)(4326008)(8676002)(66476007)(66556008)(83380400001)(7049001)(66946007)(6512007)(41300700001)(6666004)(2906002)(26005)(478600001)(8936002)(4744005)(5660300002)(6506007)(86362001)(52116002)(6486002)(38350700002)(38100700002)(110136005)(186003)(36756003)(316002)(2616005)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WMaGnVdkP9+AmpRe66J0J31fw24P4y9I1VkCyIqX7wXBpgM0saDBrxCQhVtUI1b/kLfj//tDe6twWFw6w0vbiHkP8wHJtVzomTV/MiKMMfYqnitoXGCpKbR2IQN4bIV1JRrpT+jd+ku3U83NiEpW643xmfjKJXggkz8T9f+mTU065+bqW6oNhU+MRaUtubco0S7E9WbiCG1BSbEfGTx6AMzYS+u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VB2dzb3e3nscjIhnnebpRZVFIgEe2TgohDe05142vLD53H8gzJxwZExqMuTTexDp9H4RR8tq2p87C5xdj9p9dtM/tsCvORsv9TnaGilokiaJjF6xyWltT/BGGy3aowN27ChLWMxQM2iMaD+F/ZgHNiymdgnIli1j1UIejsH0TrqFRuJuQrISvMzfY7Sx6IZgxKvzZTbLNmlXASmXDHPRfqYuS7donow8UvHOq8A+Q1jGbb47qZND1SRhPWMQkKvcCjOqTzBwNvdxA1VDV6CIrHRc/1sODAwVbTfRFycUhufM/nywIe9BbXXER X-OriginatorOrg: analogixsemi.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d38d6fa-5102-4b74-87fe-08da6bbadc41 X-MS-Exchange-CrossTenant-AuthSource: BY5PR04MB6739.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 08:19:13.0667 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b099b0b4-f26c-4cf5-9a0f-d5be9acab205 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DQiFWt1oNYgID6eMw2t4RSnjdip0Ps7Sa8t4rngENHy+BRajsHyUEuzYM5ttlOOJFtAkNWOPXoAaSCx5HsIZ5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR04MB5986 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix anx7411_i2c_probe() warn: missing error code 'ret'. Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support") Signed-off-by: Xin Ji --- drivers/usb/typec/anx7411.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index dc86b6704cbd..525022c24e05 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -1483,12 +1483,14 @@ static int anx7411_i2c_probe(struct i2c_client *client, if (!plat->intp_irq) { dev_err(dev, "fail to get interrupt IRQ\n"); + ret = -ENODEV; goto free_typec_port; } plat->dev = dev; plat->psy_online = ANX7411_PSY_OFFLINE; - if (anx7411_psy_register(plat)) { + ret = anx7411_psy_register(plat); + if (ret) { dev_err(dev, "register psy\n"); goto free_typec_port; }