drivers/video/fbdev/pxafb.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
Convert to use devm_kmemdup() and devm_kmemdup_array() which are
more robust.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
This depends on changes available on immutable tag[1].
[1] https://lore.kernel.org/r/Z7xGpz3Q4Zj6YHx7@black.fi.intel.com
v2: Split patch series per subsystem
drivers/video/fbdev/pxafb.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 4aa84853e31a..ee6da5084242 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2233,32 +2233,27 @@ static int pxafb_probe(struct platform_device *dev)
{
struct pxafb_info *fbi;
struct pxafb_mach_info *inf, *pdata;
- int i, irq, ret;
+ int irq, ret;
dev_dbg(&dev->dev, "pxafb_probe\n");
ret = -ENOMEM;
pdata = dev_get_platdata(&dev->dev);
- inf = devm_kmalloc(&dev->dev, sizeof(*inf), GFP_KERNEL);
- if (!inf)
- goto failed;
-
if (pdata) {
- *inf = *pdata;
- inf->modes =
- devm_kmalloc_array(&dev->dev, pdata->num_modes,
- sizeof(inf->modes[0]), GFP_KERNEL);
+ inf = devm_kmemdup(&dev->dev, pdata, sizeof(*pdata), GFP_KERNEL);
+ if (!inf)
+ goto failed;
+
+ inf->modes = devm_kmemdup_array(&dev->dev, pdata->modes, pdata->num_modes,
+ sizeof(*pdata->modes), GFP_KERNEL);
if (!inf->modes)
goto failed;
- for (i = 0; i < inf->num_modes; i++)
- inf->modes[i] = pdata->modes[i];
} else {
inf = of_pxafb_of_mach_info(&dev->dev);
+ if (IS_ERR_OR_NULL(inf))
+ goto failed;
}
- if (IS_ERR_OR_NULL(inf))
- goto failed;
-
ret = pxafb_parse_options(&dev->dev, g_options, inf);
if (ret < 0)
goto failed;
base-commit: b8c38ccb2ca52b9a38cfeb9f89abab5d6e713221
--
2.34.1
On Fri, Feb 28, 2025 at 12:40:09PM +0530, Raag Jadav wrote: > Convert to use devm_kmemdup() and devm_kmemdup_array() which are > more robust. FWIW, Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> -- With Best Regards, Andy Shevchenko
On Fri, Feb 28, 2025 at 02:37:05PM +0200, Andy Shevchenko wrote: > On Fri, Feb 28, 2025 at 12:40:09PM +0530, Raag Jadav wrote: > > Convert to use devm_kmemdup() and devm_kmemdup_array() which are > > more robust. > > FWIW, > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thank you. Anything I can do to move this forward? Raag
On 3/8/25 22:01, Raag Jadav wrote: > On Fri, Feb 28, 2025 at 02:37:05PM +0200, Andy Shevchenko wrote: >> On Fri, Feb 28, 2025 at 12:40:09PM +0530, Raag Jadav wrote: >>> Convert to use devm_kmemdup() and devm_kmemdup_array() which are >>> more robust. >> >> FWIW, >> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Thank you. > > Anything I can do to move this forward? Applied to fbdev git tree. Thanks! Helge
On Sat, Mar 08, 2025 at 10:12:16PM +0100, Helge Deller wrote: > On 3/8/25 22:01, Raag Jadav wrote: > > On Fri, Feb 28, 2025 at 02:37:05PM +0200, Andy Shevchenko wrote: > > > On Fri, Feb 28, 2025 at 12:40:09PM +0530, Raag Jadav wrote: > > > > Convert to use devm_kmemdup() and devm_kmemdup_array() which are > > > > more robust. > > > > > > FWIW, > > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > > Thank you. > > > > Anything I can do to move this forward? > > Applied to fbdev git tree. Thank you. FYI: This depends on the immutable tag (mentioned with changelog). Raag
© 2016 - 2025 Red Hat, Inc.