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 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 79111EDEBF1 for ; Tue, 3 Mar 2026 21:22:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 606AB10E8D4; Tue, 3 Mar 2026 21:22:48 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 72FB710E8D4 for ; Tue, 3 Mar 2026 21:22:47 +0000 (UTC) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vxXBs-0000S8-Bq; Tue, 03 Mar 2026 22:22:04 +0100 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vxXBo-003bpC-2q; Tue, 03 Mar 2026 22:22:02 +0100 Received: from mfe by pty.whiteo.stw.pengutronix.de with local (Exim 4.98.2) (envelope-from ) id 1vxXBq-0000000G9tJ-0Owv; Tue, 03 Mar 2026 22:22:02 +0100 Date: Tue, 3 Mar 2026 22:22:02 +0100 From: Marco Felsch To: Frank Li Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Peng Fan , Liu Ying , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , luca.ceresoli@bootlin.com, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v11 2/3] drm/bridge: imx: Add i.MX93 parallel display format configuration support Message-ID: <3dyb7wc7tg6hc4o4qocn4nft7bu3hbdpxcnv7cln2q6vkxo7bw@dtnswwyou5sp> References: <20260303-v6-18-topic-imx93-parallel-display-v11-2-1b03733c8461@pengutronix.de> <20260303210131.2966214-2-Frank.Li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260303210131.2966214-2-Frank.Li@nxp.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 26-03-03, Frank Li wrote: > From: Frank Li (AI-BOT) > > AI bot review and may be useless. Hi Frank, albeit I'm very open to new technology, I would appreciate it if your AI-BOT is used internally first till you're convinced that it reports real issues instead of false-positives. Regards, Marco > > +static u32 * > > +imx93_pdfc_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, > > + struct drm_bridge_state *bridge_state, > > + struct drm_crtc_state *crtc_state, > > + struct drm_connector_state *conn_state, > > + u32 output_fmt, > > + unsigned int *num_input_fmts) > > +{ > > + struct imx93_pdfc *pdfc = bridge_to_imx93_pdfc(bridge); > > + u32 *input_fmts; > > + > > + *num_input_fmts = 0; > > + > > + input_fmts = kmalloc_obj(*input_fmts); > > + if (!input_fmts) > > + return NULL; > > Missing kfree(input_fmts) in error path if the switch statement > or subsequent logic fails. Consider allocating a fixed-size array > or using devm_kzalloc() instead. > > > + *num_input_fmts = 1; > > + > > + if (!imx93_pdfc_bus_output_fmt_supported(output_fmt)) { > > + dev_dbg(pdfc->dev, "No valid output bus-fmt detected, fallback to MEDIA_BUS_FMT_RGB888_1X24\n"); > > Line exceeds 80 characters (97 chars). Break into two lines. > > > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; > > + return input_fmts; > > + } > > + > > + switch (output_fmt) { > > + case MEDIA_BUS_FMT_RGB888_1X24: > > + case MEDIA_BUS_FMT_RGB565_1X16: > > + input_fmts[0] = output_fmt; > > + break; > > + case MEDIA_BUS_FMT_RGB666_1X18: > > + case MEDIA_BUS_FMT_FIXED: > > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; > > + break; > > + } > > Switch statement lacks default case. Add default case to handle > unexpected format values explicitly. > > > +static int imx93_pdfc_bridge_atomic_enable(struct drm_bridge *bridge, > > + struct drm_atomic_state *state) > > +{ > > + struct imx93_pdfc *pdfc = bridge_to_imx93_pdfc(bridge); > > + const struct drm_bridge_state *bridge_state; > > + unsigned int mask = PARALLEL_DISP_FORMAT; > > + unsigned int val; > > + > > + bridge_state = drm_atomic_get_new_bridge_state(state, bridge); > > + > > + switch (bridge_state->output_bus_cfg.format) { > > + case MEDIA_BUS_FMT_RGB888_1X24: > > + case MEDIA_BUS_FMT_FIXED: > > + val = FORMAT_RGB888_TO_RGB888; > > + if (pdfc->phy_bus_width == 18) { > > + /* > > + * Can be valid if physical bus limitation exists, > > + * therefore use dev_dbg(). > > + */ > > + dev_dbg(pdfc->dev, "Truncate two LSBs from each color\n"); > > + val = FORMAT_RGB888_TO_RGB666; > > + } > > + break; > > + case MEDIA_BUS_FMT_RGB666_1X18: > > + val = FORMAT_RGB888_TO_RGB666; > > + > -- #gernperDu #CallMeByMyFirstName Pengutronix e.K. | | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |