Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1947064rwb; Mon, 7 Nov 2022 07:31:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM4LoA/eVJMeceYgmMey1mRH6uVBepXe8i9JzH3i1wR0CWInv3hrOt605YY4rv2kEUnY46ub X-Received: by 2002:a17:906:8a47:b0:7a5:8160:19a6 with SMTP id gx7-20020a1709068a4700b007a5816019a6mr49704887ejc.477.1667835072616; Mon, 07 Nov 2022 07:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667835072; cv=none; d=google.com; s=arc-20160816; b=v7fumS6YMJkr1td/mDi8hg28u5C4jojzA2CVOY3+se9Dhvmpn2MEZzIIJ/XEy4LVgM QolLNdAfAJuCY2BCKkrLj4zVndUJOJzphZCK02n2UNOxLZGoOkS1PtmzbV7dq7Ihlsxj B4LlhJz8CvUkn/27Bs7or9xRSsXUj2C7yX7P7jT8fM0PHZmsMnfiteKK34TGCWAJb7Cf SZnAbSSP/Ohu/roaAlFCSheTGXw6f/JMLUST8EwUuu04URYY60Pzc9WDByOwtLGLNprA ARgtQCIdAgZDnMPitETN4DgoVhf/sKpysMy6K9BUM+5wvbJgPzlDeqPwhbk8NPek5cXd wy6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=m9s9K4UOs/+xHYBcfQzt0H+E+MMhze9rMN8G8j2bazE=; b=jle3GyhvneBYaZ6i0jNlONffyPxELm02Cth5TktfgotyShrhb6NiAlhbY6+NV6CO+C 6rnIydjjmaxaEi9RwkaoTxoIEnID3kJL0V12ouWk4BtExS/u2GGZl4bfkmhNrW8NnjLh un6Y99fg8DAiSmRGaYNAyjjZr/3q4otb2sJRD4x0mjdBRPdzZ0bCt7dWBvVqLVYLe3Wd GJ6iOtrOozSfQhgRCMp/OAzpdPutVLZu2LV7Ys36DYDXD5KHwYCNDp6eKjsJQlhy12l5 ZxnjAQpxFP6c4WZiCiqD/UL3Ct6aYoL6xp15P4uwI/zp0lr5VyP5ar23clR9v/I2LabC xFdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=WxI9aS92; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg3-20020a1709072cc300b007ad2d85d753si7962093ejc.495.2022.11.07.07.30.49; Mon, 07 Nov 2022 07:31:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=WxI9aS92; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232526AbiKGOwH (ORCPT + 94 others); Mon, 7 Nov 2022 09:52:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232521AbiKGOwE (ORCPT ); Mon, 7 Nov 2022 09:52:04 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9E041BEB6; Mon, 7 Nov 2022 06:52:01 -0800 (PST) Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 206ED84DF9; Mon, 7 Nov 2022 15:51:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1667832717; bh=m9s9K4UOs/+xHYBcfQzt0H+E+MMhze9rMN8G8j2bazE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WxI9aS92Mh9Q/o2IvZq/XUdAODm/WMYka+sIQ4TdB14ulmU02SOfFL/NNg9PvrJbi /DAML8ekEt/s4dOMJiozMpSkSRygVDH7TFyrIspTHFz3FIaFRpwDmp/tAYnat2CiVy 3gvAAO5kg0AC7SW3E9hsZfOOCpI+bA5zR7tJHyTLlIKGg/bjdpJsbSJEzgmZ/p9hi1 d+D+hUJFaFgRfRQ+rO76/MdBaDCxAv/MALorV1TFe7P8xhDilbu6xmFZLIDXDBonGJ 5R0KnBiNs85NO8v+lVVK08uLkPiiqx1DVWQkJoQ/1sV6N4gbW8uRhJ7NxbUqPiACIQ Ji0hsvBG8i60A== Message-ID: <49a553b3-bd79-7845-41c4-2b8a3a3d4932@denx.de> Date: Mon, 7 Nov 2022 15:51:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered Content-Language: en-US To: Yassine Oudjana , MyungJoo Ham , Chanwoo Choi , =?UTF-8?Q?Alvin_=c5=a0ipraga?= , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Yassine Oudjana References: <20221107144810.588755-1-y.oudjana@protonmail.com> From: Marek Vasut In-Reply-To: <20221107144810.588755-1-y.oudjana@protonmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/7/22 15:48, Yassine Oudjana wrote: > From: Yassine Oudjana > > Commit bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support") > added an optional Type-C interface to the driver but missed to check > if it is in use when calling the IRQ handler. This causes an oops on > devices currently using the old extcon interface. Check if a Type-C > port is registered before calling the Type-C IRQ handler. > > Fixes: bf7571c00dca ("extcon: usbc-tusb320: Add USB TYPE-C support") > Signed-off-by: Yassine Oudjana > --- > drivers/extcon/extcon-usbc-tusb320.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c > index 41041ff0fadb..037bc11b2a48 100644 > --- a/drivers/extcon/extcon-usbc-tusb320.c > +++ b/drivers/extcon/extcon-usbc-tusb320.c > @@ -327,7 +327,14 @@ static irqreturn_t tusb320_irq_handler(int irq, void *dev_id) > return IRQ_NONE; > > tusb320_extcon_irq_handler(priv, reg); > - tusb320_typec_irq_handler(priv, reg); > + > + /* > + * Type-C support is optional for backward compatibility. It's the other way around, extcon is the legacy, type-c is the new, right ? > + * Only call the Type-C handler if a port had been registered > + * previously. > + */ > + if (priv->port) > + tusb320_typec_irq_handler(priv, reg); > > regmap_write(priv->regmap, TUSB320_REG9, reg); Reviewed-by: Marek Vasut Thanks!