From: Raag Jadav <raag.jadav@intel.com>
To: deller@gmx.de, tzimmermann@suse.de, andriy.shevchenko@linux.intel.com
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH v2] fbdev: pxafb: use devm_kmemdup*()
Date: Fri, 28 Feb 2025 12:40:09 +0530 [thread overview]
Message-ID: <20250228071009.150971-1-raag.jadav@intel.com> (raw)
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
next reply other threads:[~2025-02-28 7:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 7:10 Raag Jadav [this message]
2025-02-28 12:37 ` [PATCH v2] fbdev: pxafb: use devm_kmemdup*() Andy Shevchenko
2025-03-08 21:01 ` Raag Jadav
2025-03-08 21:12 ` Helge Deller
2025-03-08 21:38 ` Raag Jadav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250228071009.150971-1-raag.jadav@intel.com \
--to=raag.jadav@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=deller@gmx.de \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox