From mboxrd@z Thu Jan 1 00:00:00 1970 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 99C54C4332F for ; Mon, 7 Nov 2022 16:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232426AbiKGQal (ORCPT ); Mon, 7 Nov 2022 11:30:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232024AbiKGQaO (ORCPT ); Mon, 7 Nov 2022 11:30:14 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DDA662D4; Mon, 7 Nov 2022 08:28:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667838509; x=1699374509; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5Dh3fRjsl8pAe1P7xzifpSAyBwnCJbEPf3YfnGJ20vc=; b=Dv6XiDZbrZSaTkc9vKl8nZh/ul0K+x0smKid7vsbu/lGQk45YgkL4VGE q8oc7D/GVnae1i/aCElvTCHGJHE24NPyrwThLk6T0P5eK3hhieugqfXGT ezrrAGq166pJd5NfFF9jRKpfvzZy+EC2a8gJAIfDyDw10LrdtFE8KW0/v vuqI+h283kIksAWLHL+l0l2Iu2lWEhJPHKVtbi3yyFP7dbaJtTP4LY1mb Ri7aI1ysqDxy5S3cvBWczlWCFmw7+Ky5JT9erlAhGQ5E1IPkSXBLDNAcz SWE5mfuXhcE/Wgi2Mn7TJ1N7/Oj6ZOFqkv6HXrAawxNTjN4Oupk6msXNH A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="290176906" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="290176906" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 08:28:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="778549564" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="778549564" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 07 Nov 2022 08:28:23 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 07 Nov 2022 18:28:22 +0200 Date: Mon, 7 Nov 2022 18:28:22 +0200 From: Heikki Krogerus To: Yassine Oudjana Cc: MyungJoo Ham , Chanwoo Choi , Alvin =?utf-8?Q?=C5=A0ipraga?= , Marek Vasut , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Yassine Oudjana Subject: Re: [PATCH v2] extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered Message-ID: References: <20221107153317.657803-1-y.oudjana@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221107153317.657803-1-y.oudjana@protonmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 07, 2022 at 06:33:17PM +0300, 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 > Reviewed-by: Marek Vasut Looks good to me. FWIW: Reviewed-by: Heikki Krogerus > --- > 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 thanks, -- heikki