Convert media drivers to use devm_kmemdup_array()
Subsystems (5)
v2 cover Convert media drivers to use devm_kmemdup_array()
This series converts media drivers to use the newly introduced[1] devm_kmemdup_array() helper. This depends on changes available on immutable tag[2].
[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
v2: Split patch series per subsystem
Raag Jadav (2):
media: atmel-isi: use devm_kmemdup_array()
media: stm32-dcmi: use devm_kmemdup_array()
drivers/media/platform/atmel/atmel-isi.c | 8 ++------ drivers/media/platform/st/stm32/stm32-dcmi.c | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-)
base-commit: b8c38ccb2ca52b9a38cfeb9f89abab5d6e713221
Signature · 1 line
2.34.1
PATCH v2 1/2 media: atmel-isi: use devm_kmemdup_array()
Convert to use devm_kmemdup_array() and while at it, make the size robust against type changes.
--- drivers/media/platform/atmel/atmel-isi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/platform/atmel/atmel-isi.c +2 -6
@@ -1072,16 +1072,12 @@ static int isi_formats_init(struct atmel_isi *isi)return -ENXIO ; isi->num_user_formats = num_fmts; - isi->user_formats =devm_kcalloc (isi->dev, - num_fmts,sizeof (struct isi_format *), -GFP_KERNEL ); + isi->user_formats =devm_kmemdup_array (isi->dev, isi_fmts, num_fmts, +sizeof (isi_fmts[0 ]),GFP_KERNEL );if (!isi->user_formats)return -ENOMEM ; -memcpy (isi->user_formats, isi_fmts, - num_fmts *sizeof (struct isi_format *)); isi->current_fmt = isi->user_formats[0 ]; -return 0 ; }
Signature · 1 line
2.34.1
PATCH v2 2/2 media: stm32-dcmi: use devm_kmemdup_array()
In reply to Raag JadavConvert to use devm_kmemdup_array() and while at it, make the size robust against type changes.
--- drivers/media/platform/st/stm32/stm32-dcmi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/platform/st/stm32/stm32-dcmi.c +2 -6
@@ -1682,18 +1682,14 @@ static int dcmi_formats_init(struct stm32_dcmi *dcmi)return -ENXIO ; dcmi->num_of_sd_formats = num_fmts; - dcmi->sd_formats =devm_kcalloc (dcmi->dev, - num_fmts,sizeof (struct dcmi_format *), -GFP_KERNEL ); + dcmi->sd_formats =devm_kmemdup_array (dcmi->dev, sd_fmts, num_fmts, +sizeof (sd_fmts[0 ]),GFP_KERNEL );if (!dcmi->sd_formats) {dev_err (dcmi->dev,"Could not allocate memory\n" );return -ENOMEM ; } -memcpy (dcmi->sd_formats, sd_fmts, - num_fmts *sizeof (struct dcmi_format *)); dcmi->sd_format = dcmi->sd_formats[0 ]; -return 0 ; }
Signature · 1 line
2.34.1
Quoted 6 lines · Raag Jadav
This series converts media drivers to use the newly introduced[1]
devm_kmemdup_array()helper. This depends on changes available on immutable tag[2].[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]
Bump, anything I can do to move this forward?
Raag
Hi Raag,
Quoted 9 lines · Raag Jadav
Quoted 6 lines · Raag Jadav
This series converts media drivers to use the newly introduced[1]
devm_kmemdup_array()helper. This depends on changes available on immutable tag[2].[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]Bump, anything I can do to move this forward?
The patches these depend on (those adding devm_kmemdup_array()) aren't in the Media tree yet. They don't seem urgent though so I'd just wait.
Speaking of the patches themselves: I'd use *array instead of array[0] for sizeof argument.
Signature · 3 lines
Regards, Sakari Ailus
Quoted 8 lines · Sakari Ailus
Hi Raag,
Quoted 5 lines · Raag Jadav
Quoted 4 lines · Raag Jadav
This series converts media drivers to use the newly introduced[1]
devm_kmemdup_array()helper. This depends on changes available on immutable tag[2].
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]Bump, anything I can do to move this forward?
The patches these depend on (those adding
devm_kmemdup_array()) aren't in the Media tree yet. They don't seem urgent though so I'd just wait.
I was hoping the immutable tag would be useful here. But sure, no problem.
Quoted 2 lines
Speaking of the patches themselves: I'd use *array instead of array[0] for sizeof argument.
I know it doesn't matter much to the compiler but since the source itself is an array here, doesn't [0] make more sense?
Raag
Hi Raag,
Quoted 17 lines · Raag Jadav
Quoted 8 lines · Sakari Ailus
Hi Raag,
Quoted 5 lines · Raag Jadav
Quoted 4 lines · Raag Jadav
This series converts media drivers to use the newly introduced[1]
devm_kmemdup_array()helper. This depends on changes available on immutable tag[2].Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]Bump, anything I can do to move this forward?
The patches these depend on (those adding
devm_kmemdup_array()) aren't in the Media tree yet. They don't seem urgent though so I'd just wait.
Quoted 7 lines
I was hoping the immutable tag would be useful here. But sure, no problem.
Quoted 2 lines
Speaking of the patches themselves: I'd use *array instead of array[0] for sizeof argument.
I know it doesn't matter much to the compiler but since the source itself is an array here, doesn't [0] make more sense?
The element at index 0 isn't anyhow special in this respect so I do prefer *array instead. In practice it works either way of course.
Signature · 3 lines
Regards, Sakari Ailus