drivers/media/platform/amphion/vpu.h | 1 - drivers/media/platform/amphion/vpu_core.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-)
"vpu_core->msg_buffer_size" is unused out-side of vpu_core_register().
There is no need to save this value in struct vpu_core.
Remove it and use a local variable instead.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/media/platform/amphion/vpu.h | 1 -
drivers/media/platform/amphion/vpu_core.c | 7 ++++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h
index 22f0da26ccec..1451549c9dd2 100644
--- a/drivers/media/platform/amphion/vpu.h
+++ b/drivers/media/platform/amphion/vpu.h
@@ -162,7 +162,6 @@ struct vpu_core {
struct delayed_work msg_delayed_work;
struct kfifo msg_fifo;
void *msg_buffer;
- unsigned int msg_buffer_size;
struct vpu_dev *vpu;
void *iface;
diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
index 8df85c14ab3f..da00f5fc0e5d 100644
--- a/drivers/media/platform/amphion/vpu_core.c
+++ b/drivers/media/platform/amphion/vpu_core.c
@@ -250,6 +250,7 @@ static void vpu_core_get_vpu(struct vpu_core *core)
static int vpu_core_register(struct device *dev, struct vpu_core *core)
{
struct vpu_dev *vpu = dev_get_drvdata(dev);
+ unsigned int buffer_size;
int ret = 0;
dev_dbg(core->dev, "register core %s\n", vpu_core_type_desc(core->type));
@@ -263,14 +264,14 @@ static int vpu_core_register(struct device *dev, struct vpu_core *core)
}
INIT_WORK(&core->msg_work, vpu_msg_run_work);
INIT_DELAYED_WORK(&core->msg_delayed_work, vpu_msg_delayed_work);
- core->msg_buffer_size = roundup_pow_of_two(VPU_MSG_BUFFER_SIZE);
- core->msg_buffer = vzalloc(core->msg_buffer_size);
+ buffer_size = roundup_pow_of_two(VPU_MSG_BUFFER_SIZE);
+ core->msg_buffer = vzalloc(buffer_size);
if (!core->msg_buffer) {
dev_err(core->dev, "failed allocate buffer for fifo\n");
ret = -ENOMEM;
goto error;
}
- ret = kfifo_init(&core->msg_fifo, core->msg_buffer, core->msg_buffer_size);
+ ret = kfifo_init(&core->msg_fifo, core->msg_buffer, buffer_size);
if (ret) {
dev_err(core->dev, "failed init kfifo\n");
goto error;
--
2.49.0
Le vendredi 18 avril 2025 à 00:01 +0200, Christophe JAILLET a écrit :
> "vpu_core->msg_buffer_size" is unused out-side of vpu_core_register().
> There is no need to save this value in struct vpu_core.
>
> Remove it and use a local variable instead.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
thanks,
Nicolas
> ---
> drivers/media/platform/amphion/vpu.h | 1 -
> drivers/media/platform/amphion/vpu_core.c | 7 ++++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h
> index 22f0da26ccec..1451549c9dd2 100644
> --- a/drivers/media/platform/amphion/vpu.h
> +++ b/drivers/media/platform/amphion/vpu.h
> @@ -162,7 +162,6 @@ struct vpu_core {
> struct delayed_work msg_delayed_work;
> struct kfifo msg_fifo;
> void *msg_buffer;
> - unsigned int msg_buffer_size;
>
> struct vpu_dev *vpu;
> void *iface;
> diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
> index 8df85c14ab3f..da00f5fc0e5d 100644
> --- a/drivers/media/platform/amphion/vpu_core.c
> +++ b/drivers/media/platform/amphion/vpu_core.c
> @@ -250,6 +250,7 @@ static void vpu_core_get_vpu(struct vpu_core *core)
> static int vpu_core_register(struct device *dev, struct vpu_core *core)
> {
> struct vpu_dev *vpu = dev_get_drvdata(dev);
> + unsigned int buffer_size;
> int ret = 0;
>
> dev_dbg(core->dev, "register core %s\n", vpu_core_type_desc(core->type));
> @@ -263,14 +264,14 @@ static int vpu_core_register(struct device *dev, struct vpu_core *core)
> }
> INIT_WORK(&core->msg_work, vpu_msg_run_work);
> INIT_DELAYED_WORK(&core->msg_delayed_work, vpu_msg_delayed_work);
> - core->msg_buffer_size = roundup_pow_of_two(VPU_MSG_BUFFER_SIZE);
> - core->msg_buffer = vzalloc(core->msg_buffer_size);
> + buffer_size = roundup_pow_of_two(VPU_MSG_BUFFER_SIZE);
> + core->msg_buffer = vzalloc(buffer_size);
> if (!core->msg_buffer) {
> dev_err(core->dev, "failed allocate buffer for fifo\n");
> ret = -ENOMEM;
> goto error;
> }
> - ret = kfifo_init(&core->msg_fifo, core->msg_buffer, core->msg_buffer_size);
> + ret = kfifo_init(&core->msg_fifo, core->msg_buffer, buffer_size);
> if (ret) {
> dev_err(core->dev, "failed init kfifo\n");
> goto error;
© 2016 - 2026 Red Hat, Inc.