Messages in this thread | | | From | Huibin Shi <> | Subject | RE: [PATCH] Add Silicom Platform Driver | Date | Tue, 8 Aug 2023 20:39:14 +0000 |
| |
I mean this is the kernel implementation of devm_kmemdup() function in /driver/base/devres.c.
Henry -----Original Message----- From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck Sent: Tuesday, August 8, 2023 3:36 PM To: Huibin Shi <henrys@silicom-usa.com>; Christophe JAILLET <christophe.jaillet@wanadoo.fr>; Henry Shi <henryshi2018@gmail.com>; hbshi69@hotmail.com; tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; dave.hansen@linux.intel.com; x86@kernel.org; hpa@zytor.com; hdegoede@redhat.com; markgross@kernel.org; jdelvare@suse.com; linux-kernel@vger.kernel.org; platform-driver-x86@vger.kernel.org; linux-hwmon@vger.kernel.org Cc: hb_shi2003@yahoo.com; Wen Wang <wenw@silicom-usa.com> Subject: Re: [PATCH] Add Silicom Platform Driver
Caution: This is an external email. Please take care when clicking links or opening attachments.
On 8/8/23 12:19, Huibin Shi wrote: > Guenter, > > Here is the implementation of devm_kmemdup(), *src is the extra > argument > > void *devm_kmemdup(struct device *dev, const void *src, size_t len, > gfp_t gfp) { > void *p; > > p = devm_kmalloc(dev, len, gfp); > if (p) > memcpy(p, src, len); > > return p; > } >
So you don't want to use devm_kmemdup() because of its 'src' argument, and instead re-implement it locally by using devm_kzalloc() followed by memcpy() ? Really ?
Guenter
| |