[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230309160201.5163-40-tzimmermann@suse.de>
Date: Thu, 9 Mar 2023 17:00:59 +0100
From: Thomas Zimmermann <tzimmermann@...e.de>
To: deller@....de, geert+renesas@...der.be, timur@...nel.org,
rdunlap@...radead.org, paulus@...ba.org, benh@...nel.crashing.org,
linux@...linux.org.uk, pjones@...hat.com, adaplas@...il.com,
s.hauer@...gutronix.de, shawnguo@...nel.org, mbroemme@...mpq.org,
thomas@...ischhofer.net, James.Bottomley@...senPartnership.com,
sudipm.mukherjee@...il.com, teddy.wang@...iconmotion.com,
corbet@....net
Cc: linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Thomas Zimmermann <tzimmermann@...e.de>
Subject: [PATCH v2 039/101] fbdev/imxfb: Duplicate video-mode option string
Assume that the driver does not own the option string or its substrings
and hence duplicate the option string for the video mode. Allocate the
copy's memory with devm_kstrdup(), as the driver parses the option string
once per probed device. Linux will automatically free the memory upon
releasing the device.
Done in preparation of switching the driver to struct option_iter and
constifying the option string.
Signed-off-by: Thomas Zimmermann <tzimmermann@...e.de>
---
drivers/video/fbdev/imxfb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index 51fde1b2a793..aad7d447385c 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -843,7 +843,7 @@ static struct lcd_ops imxfb_lcd_ops = {
.set_power = imxfb_lcd_set_power,
};
-static int imxfb_setup(void)
+static int imxfb_setup(struct platform_device *pdev)
{
char *opt, *options = NULL;
@@ -856,8 +856,8 @@ static int imxfb_setup(void)
while ((opt = strsep(&options, ",")) != NULL) {
if (!*opt)
continue;
- else
- fb_mode = opt;
+
+ fb_mode = devm_kstrdup(&pdev->dev, opt, GFP_KERNEL); // ignore errors
}
return 0;
@@ -877,7 +877,7 @@ static int imxfb_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "i.MX Framebuffer driver\n");
- ret = imxfb_setup();
+ ret = imxfb_setup(pdev);
if (ret < 0)
return ret;
--
2.39.2
Powered by blists - more mailing lists