From patchwork Wed Feb 2 08:17:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12732696 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B04D1C433EF for ; Wed, 2 Feb 2022 08:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qb6c9h292FUuVs5F8yH9zlo68cxHyTf5abhqGkP/5Qg=; b=f6rP7GVIPXupgC RJACpZbdSyAWjLqpwBDcLH4jekr3u8/PNhbjr2IyxPMgd5vpkjyWqXVWr71TY8HsL/olFF6UGQATp 3lHb33bmpVWT1dkenjzG4Fk/OJAgLd3Q7mCP/hIEBOChXfk5lT6HQn/XejiHfLmOgt77t3T8fWXtL OVU2y8df2p6pPhldMdvK9T+IvViWo/qwr/aPrUwTG/1lQpNFUPyxJVG/L+x3vP0Md/Gb5X1rLg2ew E4JUzwmz+WdbeVFlgkjvYbSozGOETrZtniuvFMANGfmcQQm4uQ2LIXWTngH5//CLJKrY8jxK7hA26 9o+4N8/t/odJQW9VwEhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFAqQ-00EXqM-7S; Wed, 02 Feb 2022 08:18:26 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFAqD-00EXm7-9w for linux-arm-kernel@lists.infradead.org; Wed, 02 Feb 2022 08:18:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643789893; x=1675325893; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GwW1AHWp4yInCJeFGSw5ytM4s1rzTas8PEVpMvVFWZE=; b=Wrcyspl05xCvkwSmvoJByi9byuaICflNYdOmb9A87ExF+cSWJMQcKpYJ QofI/KFscZH8EuZGnyGSeYyq8RAYEi8dK4b05Y/U8kbJoTlxPxb9SmsSx myj9LUShPN5JQtlw4JWt6Omid9j64puOLJiLqWAd+YJ8OjcEMVOxyYwp/ 4kC0w+H+CLgzUM+khlk1904AKsSrgWsUxTMdm+Kx84WP8hHs97TZk6ApR ENjWgxk5eGtgvpZfKQgwCa12vpBAbO6oR9QFU2DlHvxRVWpMdTUoMYRhR ye+VlR0COAjpjfzfODQxPYf2OsFep9hSSEtgK56wGsH5eKc8AhCiKL48/ g==; X-IronPort-AV: E=Sophos;i="5.88,336,1635199200"; d="scan'208";a="21844619" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 02 Feb 2022 09:18:04 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 02 Feb 2022 09:18:04 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 02 Feb 2022 09:18:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643789884; x=1675325884; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GwW1AHWp4yInCJeFGSw5ytM4s1rzTas8PEVpMvVFWZE=; b=DfDwK33op8JtL6wyh+1gO8wZMDiWPk1fxYYujbsucFr6WRxAEYIT5jfz Bk9v4kiXQ123+VlGouHgh2Xil3ng7smA5S1UsZO0d2jDgVYZ8sZKMT8VN 4ZhUa6rE3JUoEL8tFUoxiNoeLRim3axZPKdx6HHgNUrC37px+hcwmOhfg yYtttO+Gi64oMRH8As3C9Nw2p69HG3MgPTvGIpqMVBqjNS+8a+xX19o9l DaqbTPfXy7cOwdwTFvFC6S9zLCz4nwcGhFmDZ1B7wX59aCj+lE04wSWb8 zfPL/aiInE/1A4bhLbB/ZGVC0CyNVSD8jbh+TBqO0O22zIYwChWnr/tA4 w==; X-IronPort-AV: E=Sophos;i="5.88,336,1635199200"; d="scan'208";a="21844618" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 02 Feb 2022 09:18:04 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 66AA8280075; Wed, 2 Feb 2022 09:18:04 +0100 (CET) From: Alexander Stein To: Marek Vasut , Stefan Agner , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/2] drm: mxsfb: Use dev_err_probe() helper Date: Wed, 2 Feb 2022 09:17:54 +0100 Message-Id: <20220202081755.145716-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220202081755.145716-1-alexander.stein@ew.tq-group.com> References: <20220202081755.145716-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220202_001813_686682_EA51A9A3 X-CRM114-Status: GOOD ( 13.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the dev_err_probe() helper, instead of open-coding the same operation. This also adds a nice hint in /sys/kernel/debug/devices_deferred. Reviewed-by: Marek Vasut Signed-off-by: Alexander Stein --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 375f26d4a417..c4da358f2154 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -258,8 +258,7 @@ static int mxsfb_load(struct drm_device *drm, ret = mxsfb_attach_bridge(mxsfb); if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(drm->dev, "Cannot connect bridge: %d\n", ret); + dev_err_probe(drm->dev, ret, "Cannot connect bridge\n"); goto err_vblank; } From patchwork Wed Feb 2 08:17:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12732698 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 232BAC433F5 for ; Wed, 2 Feb 2022 08:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BVF57HpmzGXxl1U5YeS/drOSaQW07Mu0uX1qIBNzV8I=; b=qlx9lhoZk3MulP 1vrfHqRnneRewy4zN3aQsU9ILUuh4GxbxUaAoXgtM6tEb8TJxEi8gmdJHncZXDor3G7mVeFNXxWcW WwU6MOvYJbkCTl6jXbm7rq43ZPdr14Gf/VwigKqnowm15QeDAB0qOEfk9YopBbT2ZS68trLBMXlpC nuuLTQMchpSArIacIXk7VZBO+3Mi3zRofJg49IK0hBXzgL7gfSCNxlxECAxGKQIwF3L9OndrUBTRr pb6CzZ4Z53QVRNQgQoh8OYhixMkrXmtkhedVXVh4BpkrH4tDomYoQ+ek9bztlu8uVDVRFvR+xiOZA kZngs9J4r2aajUBgoDgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFAqZ-00EXsB-MK; Wed, 02 Feb 2022 08:18:35 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFAqE-00EXmm-ET for linux-arm-kernel@lists.infradead.org; Wed, 02 Feb 2022 08:18:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643789894; x=1675325894; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=upUdRNc2H9LGx6pOVpcm0rc5dRiRMZ/3v9/QOVk8QmY=; b=ZZgpiUkBKQDz/JoRf92aLk6du/YtRsvdRsUIulxhDbWjxpOSaDGaJEkT hFZQhkbKZfLyonwM6KOh6CaOx+nPyDq12XqrJocdTUF3dYaGjujD5y1pH 6cL2+8NZSDCzEiYixI6EUB5sO1Vyswh5EoudWspgiOgkrcRUuKPnoF1xG Qxi0P8GHufMgSkUW8izjBPdaI7C/sEQq+Um+/xbmQEEo1lG4Qri3J+7zS yjvHV4F8cCoj/9KGgvRAqeKOy+hLP9brmWBxnrF5+1xlWfrbUa90BnXNy Y4aeTLlMAaX+Ho3YeAxl+wL/cwf+RVDHC9Ncw66LXYgNiLrPPOu9Z0B3s w==; X-IronPort-AV: E=Sophos;i="5.88,336,1635199200"; d="scan'208";a="21844621" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 02 Feb 2022 09:18:04 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 02 Feb 2022 09:18:04 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 02 Feb 2022 09:18:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1643789884; x=1675325884; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=upUdRNc2H9LGx6pOVpcm0rc5dRiRMZ/3v9/QOVk8QmY=; b=hAPzMN8iZFz7B2++PM1hvSL2T7NxC9DQQUVX3Q46Vh2kkBhdK4EmymEt AbNMtdp4DZNilvi+woZZY6ubPzultbmx9AH4vmluCnFs4D/6oAI8XslaQ x5nEf0qoIoCm75XHKrRyni/m93wM1+pmJ77AeLkRRzNPWDD3i+fGOi/0v CayNVmmZKmeo8sq59wZqIzo3I7o53t8hbDuT8SeJU58IolSgYZUUcVIuU jyfyzkYjpw4QJyf49UiK7rtrmrE3I3sMcLJByajSP9LUenmdJMhl0rsE7 BLdHHD1H/wk27yLmVs98I2UEqC3ZNT+7FYVA1zKx/A2pD6seCPYJS/evw g==; X-IronPort-AV: E=Sophos;i="5.88,336,1635199200"; d="scan'208";a="21844620" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 02 Feb 2022 09:18:04 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 9A03E280065; Wed, 2 Feb 2022 09:18:04 +0100 (CET) From: Alexander Stein To: Marek Vasut , Stefan Agner , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/2] drm: mxsfb: Fix NULL pointer dereference Date: Wed, 2 Feb 2022 09:17:55 +0100 Message-Id: <20220202081755.145716-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220202081755.145716-1-alexander.stein@ew.tq-group.com> References: <20220202081755.145716-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220202_001814_832707_E4185B58 X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org mxsfb should not never dereference the NULL pointer which drm_atomic_get_new_bridge_state is allowed to return. Assume a fixed format instead. Fixes: commit b776b0f00f24 ("drm: mxsfb: Use bus_format from the nearest bridge if present") Signed-off-by: Alexander Stein --- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c index 0655582ae8ed..4cfb6c001679 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c @@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, bridge_state = drm_atomic_get_new_bridge_state(state, mxsfb->bridge); - bus_format = bridge_state->input_bus_cfg.format; + if (!bridge_state) + bus_format = MEDIA_BUS_FMT_FIXED; + else + bus_format = bridge_state->input_bus_cfg.format; + if (bus_format == MEDIA_BUS_FMT_FIXED) { dev_warn_once(drm->dev, "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"