Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2024884rwb; Mon, 7 Nov 2022 08:19:10 -0800 (PST) X-Google-Smtp-Source: AMsMyM74JTcmGR2GhUTqiS5tMrrieCG2tEQoZPtfhdXt+aWcsG8R//FsTsXi1f5FtDR3lfyhhBVP X-Received: by 2002:a17:902:9a0a:b0:188:4f8b:abb8 with SMTP id v10-20020a1709029a0a00b001884f8babb8mr26049131plp.157.1667837949894; Mon, 07 Nov 2022 08:19:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667837949; cv=none; d=google.com; s=arc-20160816; b=zjlKqx5+nMI7NUUb841A6fcbpNGo7I0uFbvzLr7yGZddhx30xcdw0ivR9cQsuYZfSE fdjgbFg4xaRI2/Iur5FulvgRxXP2x2M7uGEFIY0793AXyg6aoGFgSRinAoXJMZ12W2yc QifcVzh2zrC2GPEWMvK4OA6prHFVrOUucWJI/uHmSbEj716J0fRk23NMceTqSbS1eAJM Xa0Jccc7q4soeSC0gHNojtEkGIsYlIg0K7h2Obl0k7wrpPC8PvmLJO5n6xL9Q4KG0Nqn uWuZOkSsCUiv+vTiXo7RJRxArRYBgMfhZOxzUHhIfYgEiVfoLktgG7uuop2cdzuneAxa TL6A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=L1N3AZluJC5PMpvDgMOhDOY9j2qE8n3HGiZz4zfJ5qE=; b=adECIVgiU6jdafdTt+At80kmgIF2D+OZxCFPZRnavdxoxfpqpFN1BC9eEGM8kY9Hzh 3k0UVu3j4991/7eJp8q3tzmAus0MxU02iUNFVwSXHMf4WzFPlTClWWgi+X7ILjpkd+hl sZO5Ftbex53xe45LLrev5+2tfykSj2Y7E8zOHnYakAqPE95hNnrta8wehl7qCm60gpCG el9pWspre8/ySUGHPIGd3EmNX4SRpvB1L3DjaM2qzN+vIAZZCXEM54+PCab2lMHXHkQF 6MPuAIAZ6y2QSJf1IJEQodQ3nHxmnZgaFRWnRJJovxbDqx1T46/GxqpfOEhxdgUGWuoj kEoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rkma8QkC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e125-20020a636983000000b0047077aa5008si4769102pgc.578.2022.11.07.08.18.54; Mon, 07 Nov 2022 08:19:09 -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=@gmail.com header.s=20210112 header.b=Rkma8QkC; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231946AbiKGOsj (ORCPT + 92 others); Mon, 7 Nov 2022 09:48:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231249AbiKGOsi (ORCPT ); Mon, 7 Nov 2022 09:48:38 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 815FD1581D; Mon, 7 Nov 2022 06:48:36 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id z14so16575551wrn.7; Mon, 07 Nov 2022 06:48:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=L1N3AZluJC5PMpvDgMOhDOY9j2qE8n3HGiZz4zfJ5qE=; b=Rkma8QkCBGz3zCp7ddqCDHMuRgU+2izMkr6rzs57tin6XmNxRbMNYFmppsEOzu3wC2 hNmOzbRFJE+74isWC8SSJm7e2W//5OXwaD5IZp6A80s+S2134FKGJMc1T7caEhBPYP5w 7ODJYi3CQclJS72auvHJd6ht/V6ADz7jr1t9FL5VIocQO/UsL71DL9GmAFrc+eQUE2+O D0rqz+TcfQVdd5x4LTIdEMp1GkUeZH0Ngi+uhZmZNrw8jszu3bRqG18DtubxS2SjrwCa I3iJbFsxOfOH9aauVXOPlJDmwRWMZGRG/hiFsjVGtIR+1TChqqjGiUqHgw6BjOjpMGgk Rhsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=L1N3AZluJC5PMpvDgMOhDOY9j2qE8n3HGiZz4zfJ5qE=; b=Y5ILIWttf4c9U058Mca3LTdbGS8DCy9plRqTP/L9nPf0NDkU3VKGKckBAmoRh8Okzs kBTwQ1puRIWlrJ9Ists12gKis9bwR4+wuAip3liZoggF4vyqZ+qpu0mtpGz8bn9kplqU y0cdA/kJlnKQfaJQ+XyC8WOBMWWGrrpE+3T+wk3PKDuEj2J8YjIgS9sXakEIplixeo+E I3nmI3rrw8PwuAmKNbhzRUOy2NuFu0nD+jUxpKAYv3cpXlao0DnUva+SE/LgpJ3UVfiD P7HrXZ1too4Q8iL6lTa9OBlVng+hy8sH/ltz0GvNH+153PW3N7TghxjPNRzP7r1+qEzw s50A== X-Gm-Message-State: ACrzQf3ycsBwCc7iftKn+ob1lV5vBTUY93kgLgeuJWB6jbDEAi3QoXnN n+LT5AN4KSHvNCx0vxUny8w= X-Received: by 2002:a5d:5e84:0:b0:236:cdb8:c67f with SMTP id ck4-20020a5d5e84000000b00236cdb8c67fmr25941828wrb.159.1667832514985; Mon, 07 Nov 2022 06:48:34 -0800 (PST) Received: from localhost.localdomain ([95.183.227.98]) by smtp.gmail.com with ESMTPSA id m1-20020a7bca41000000b003c6c3fb3cf6sm8418820wml.18.2022.11.07.06.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 06:48:34 -0800 (PST) From: Yassine Oudjana X-Google-Original-From: Yassine Oudjana To: MyungJoo Ham , Chanwoo Choi , =?UTF-8?q?Alvin=20=C5=A0ipraga?= , Heikki Krogerus , Marek Vasut , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Yassine Oudjana , Yassine Oudjana Subject: [PATCH] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered Date: Mon, 7 Nov 2022 17:48:10 +0300 Message-Id: <20221107144810.588755-1-y.oudjana@protonmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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. + * 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); -- 2.38.1