Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2022511rwb; Mon, 7 Nov 2022 08:17:35 -0800 (PST) X-Google-Smtp-Source: AMsMyM58Xn8OIcKq5hiZGIOOdy9RDpLzgp5cr7L2S42Uql70/FK04rlnLHfqOTTv9cU3s+fy2Inm X-Received: by 2002:a17:902:e952:b0:17c:7aaa:c679 with SMTP id b18-20020a170902e95200b0017c7aaac679mr51784967pll.74.1667837855566; Mon, 07 Nov 2022 08:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667837855; cv=none; d=google.com; s=arc-20160816; b=LHQNfgFI1i8a9eayhbbYV9QHm0hnYDRU6fq64sDBbFLy0ELVYoapFv7c5V5WadYEH4 w5VgZUY/3Ix0YE7MQAOZ4CVpYqQRtnKr3rxbisrs6fW99qizQtE0auZHexZzgn8lwepm ktTiKltNkeQvXH+PFFAeyjoHXb5FyhEZzHIOkctQIGvutFNBl8PGtI2rTLxRfsvDe2jG n25pW/jImfKnnmNzIdvCfFUvSHi5gBaN6+IfyvVuRl8eCK0bM6oSAk0AD7fpZh4wy9xD Ame4v0DOYp5CYKH0dwTmQUTD2aVUa8uxh8MXh0Ee1r1/ShtF5ZiRXKmcI9im7iOhZyUU 3hKg== 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=QNmLWsv0kOPbaij43L8PfdGtUfA1FHnBM0jiToGdqOU=; b=pIvuHU+d3599kZROR2wdHI6OMKBQzyuEprYb8k4B3mrQ0c0K4cp1J7YRNp89wn3urD BVgASMzkkNu6a/P5uUAjvIsgO/TVf9upbX2INXW/UDtxAqtipHrOgyVKxdpwHyQiC8NH m/SFuAbZrP0A7uRju5Hs2De6Yb3JdJ17NACHm9nT9Q/g/ICMnXnbWT+Cmk3duFiEq3oI vXwkGTvndjC/rV20RIv4qJTiGfsXM9XQj4kQLcmpfGinBhwcXYyldal4KNtnrE+R12gZ sSMs5yf9Pl5ck8qzDPYn+y2YccB6N9/YyHfJgxbu7r42niseBHj7x7pxa29MkVuyFZ1i Ve9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WdC3MC8z; 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 lb4-20020a17090b4a4400b0020ab20c54fesi18598406pjb.114.2022.11.07.08.17.22; Mon, 07 Nov 2022 08:17:35 -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=WdC3MC8z; 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 S232788AbiKGPdj (ORCPT + 92 others); Mon, 7 Nov 2022 10:33:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232041AbiKGPdh (ORCPT ); Mon, 7 Nov 2022 10:33:37 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A10DB13F2B; Mon, 7 Nov 2022 07:33:35 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id t1so7111642wmi.4; Mon, 07 Nov 2022 07:33:35 -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=QNmLWsv0kOPbaij43L8PfdGtUfA1FHnBM0jiToGdqOU=; b=WdC3MC8z3itl9c+IF64z/rV5qalzXE8UZBKgROyfzxrEug7x8+e7Yj+iOtliqkZRTj w6wrfjO0jJwzKusjCm4hScyZer/toiJA5g0NgkesWIWAw+QqpumKaspbMZSY/Pwy+d69 z9eOeFSvNlS8vIl9ohb1dmwlpb/kjmmVMK3RXlWL/DLSb9UU18uJs4BwhiH8G2fO2iSr 8ss8/oZYahLx2JuDgRYyP5qfT4uma3I+w25lta2M55Ufg1brVLNGKqs+tplpqFkQXfzS Hl0931T+In5lF+VxJIulpTSuiSCtdGz4LRUFKxm6eGQDs2GtgEQ5/Qbz215+JVD8oQ6Y 0qgg== 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=QNmLWsv0kOPbaij43L8PfdGtUfA1FHnBM0jiToGdqOU=; b=F0uxlylgbft2DkRO9OhU4yXId8ZmvytJs+z0mSxAVCwr16Oxn3YDPeM47WS5+L6tCK VFo/h9ULwf9Jaqu1Pv7xmypd36uVv0hnfQvItBQRka92HdlocU+qhoCuPGU4AX185crC wEOBIiP5jKnJXNn81wNYVLepkz7wO70tEZg4B7l5p6EsTR3E5SPqis2TQKpJxnROakhw 06O5Zh8yf86Z1d/oNMTyVsxB3WtwMOsOBjpc4Dw8jola5iT+utWd9XscN1SFSvej/7PI 1X6FzXwQF735BzIEPFEZ1XZ2fncFMMN/gwEZWm3tfcGVK1DGdnp4M97+rJCk6RnwuboK hLEA== X-Gm-Message-State: ACrzQf1Ftfv79U9ir6CRQJ30LDaCAPKMpXW18TJcVv7h7W4VQ3VmlnAo FbG+QXUtJcdHXBwk/CeGFV8= X-Received: by 2002:a05:600c:2150:b0:3cf:6c05:b4ab with SMTP id v16-20020a05600c215000b003cf6c05b4abmr31346030wml.161.1667835214116; Mon, 07 Nov 2022 07:33:34 -0800 (PST) Received: from localhost.localdomain ([95.183.227.98]) by smtp.gmail.com with ESMTPSA id q5-20020adf9dc5000000b002364835caacsm7393291wre.112.2022.11.07.07.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 07:33:33 -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 v2] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered Date: Mon, 7 Nov 2022 18:33:17 +0300 Message-Id: <20221107153317.657803-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 Reviewed-by: Marek Vasut --- Changes since v1: - Drop "for backward compatibility" from comment to avoid confusion on whether Type-C is meant to be the old or new interface. drivers/extcon/extcon-usbc-tusb320.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c index 41041ff0fadb..2a120d8d3c27 100644 --- a/drivers/extcon/extcon-usbc-tusb320.c +++ b/drivers/extcon/extcon-usbc-tusb320.c @@ -327,7 +327,13 @@ 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. 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