media: dvb-core: use vmalloc_array to simplify code

Remove array_size() calls and replace vmalloc() with vmalloc_array() to
simplify the code.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Qianfeng Rong
2025-08-12 11:53:02 +08:00
committed by Hans Verkuil
parent 9c64c5d91e
commit e4b21577b4
2 changed files with 6 additions and 6 deletions

View File

@@ -1414,8 +1414,8 @@ int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter)
if (dmxdev->demux->open(dmxdev->demux) < 0)
return -EUSERS;
dmxdev->filter = vmalloc(array_size(sizeof(struct dmxdev_filter),
dmxdev->filternum));
dmxdev->filter = vmalloc_array(dmxdev->filternum,
sizeof(struct dmxdev_filter));
if (!dmxdev->filter)
return -ENOMEM;

View File

@@ -1244,14 +1244,14 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
dvbdemux->cnt_storage = NULL;
dvbdemux->users = 0;
dvbdemux->filter = vmalloc(array_size(sizeof(struct dvb_demux_filter),
dvbdemux->filternum));
dvbdemux->filter = vmalloc_array(dvbdemux->filternum,
sizeof(struct dvb_demux_filter));
if (!dvbdemux->filter)
return -ENOMEM;
dvbdemux->feed = vmalloc(array_size(sizeof(struct dvb_demux_feed),
dvbdemux->feednum));
dvbdemux->feed = vmalloc_array(dvbdemux->feednum,
sizeof(struct dvb_demux_feed));
if (!dvbdemux->feed) {
vfree(dvbdemux->filter);
dvbdemux->filter = NULL;