From patchwork Wed Oct 12 16:28:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 13005211 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E96BC43217 for ; Wed, 12 Oct 2022 16:29:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 334D110E69B; Wed, 12 Oct 2022 16:29:17 +0000 (UTC) Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BED410E69B for ; Wed, 12 Oct 2022 16:29:11 +0000 (UTC) Received: by mail-pg1-x530.google.com with SMTP id 78so15916308pgb.13 for ; Wed, 12 Oct 2022 09:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cn1tYSp6Fs26zz8mdx6XxYmQlY8g3zLtpMK7g8RZT1U=; b=Fs4gWIc/2+USWqzntDJRD8yynnsb+1iJJm80wz2TexKT+yj1/30tVTpzfqpdS8pCvH HS4tBX00esP9gFzO0IfU6EgXKKLTonR/DMOrz79rWkAnGGazztmHzy3D0Pp9NhYjlbjx 8bPjoHnzoGMcOrDGW71iHil+DqNvPV6tnom7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cn1tYSp6Fs26zz8mdx6XxYmQlY8g3zLtpMK7g8RZT1U=; b=tBs5MNbGVvraz2BjBM4WV0NHboiy1SIoVWr0/sgpcjYEFGZSJSxfyVvTkA5442lCVj bG/NN7Ux6XCkT3tXYQAbsLFByPYxQSA1GtNr74dCLwNGCFZG3zNWewm7sFUY2/yFyphU d7Ovfcw/8aF8mMYqnNryjiXef9P/0ehFsSAayx91iSuPAKNZC1a+bJxpyZ/k0KsxntZd kgtNMZpZsld3htmNacY20akCRmt/rVK7X+WSpQEcXYxDfve76MQnXzkjmu/n65+8jG9x OHFvirN5b63VfQagr8Y0Gt8k0r3DLwy8ZWoKPy47zx/ZVtfCfFi9vTP5GBfV0nA0pvmW ySsg== X-Gm-Message-State: ACrzQf29Z2Q2YzbkDY5KbryzE4MFi89eX/Ss2sBTLoMOLqSHZmpL15NI rQTLOQVseri6kVPDv9dCqyZT8w== X-Google-Smtp-Source: AMsMyM6HxJ+lgT8f8WrnaKCblNjlb/TUbZ2wY3dcWmlOhT8Hmm5Z6eImkf02dCMv+Hli0GCNG87qgA== X-Received: by 2002:a05:6a00:8cc:b0:52c:7ab5:2ce7 with SMTP id s12-20020a056a0008cc00b0052c7ab52ce7mr31258809pfu.28.1665592150442; Wed, 12 Oct 2022 09:29:10 -0700 (PDT) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:2921:f6a9:5848:18e1]) by smtp.gmail.com with ESMTPSA id l4-20020a635704000000b0045dc85c4a5fsm9722163pgb.44.2022.10.12.09.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 09:29:09 -0700 (PDT) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter Subject: [PATCH 1/3] drm/bridge: it6505: Initialize AUX channel in it6505_i2c_probe Date: Thu, 13 Oct 2022 00:28:57 +0800 Message-Id: <20221012162900.2876686-2-treapking@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221012162900.2876686-1-treapking@chromium.org> References: <20221012162900.2876686-1-treapking@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Allen Chen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Pin-yen Lin , Hermes Wu , AngeloGioacchino Del Regno Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" During device boot, the HPD interrupt could be triggered before the DRM subsystem registers it6505 as a DRM bridge. In such cases, the driver tries to access AUX channel and causes NULL pointer dereference. Initializing the AUX channel earlier to prevent such error. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Pin-yen Lin --- drivers/gpu/drm/bridge/ite-it6505.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index a4302492cf8d..f7f6c3e20fae 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2871,10 +2871,7 @@ static int it6505_bridge_attach(struct drm_bridge *bridge, } /* Register aux channel */ - it6505->aux.name = "DP-AUX"; - it6505->aux.dev = dev; it6505->aux.drm_dev = bridge->dev; - it6505->aux.transfer = it6505_aux_transfer; ret = drm_dp_aux_register(&it6505->aux); @@ -3354,6 +3351,11 @@ static int it6505_i2c_probe(struct i2c_client *client, debugfs_init(it6505); pm_runtime_enable(dev); + it6505->aux.name = "DP-AUX"; + it6505->aux.dev = dev; + it6505->aux.transfer = it6505_aux_transfer; + drm_dp_aux_init(&it6505->aux); + it6505->bridge.funcs = &it6505_bridge_funcs; it6505->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; it6505->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |