FAILED: patch "[PATCH] media: s5p-mfc: remove an unused/uninitialized variable" failed to apply to 6.1-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 7fa37ba25a1dfc084e24ea9acc14bf1fad8af14c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025101646-overtake-starch-c0ab@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7fa37ba25a1dfc084e24ea9acc14bf1fad8af14c Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 7 Aug 2025 22:54:15 +0200
Subject: [PATCH] media: s5p-mfc: remove an unused/uninitialized variable
The s5p_mfc_cmd_args structure in the v6 driver is never used, not initialized to anything other than zero, but as of clang-21 this causes a warning:
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c:45:7: error: variable 'h2r_args' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
45 | &h2r_args);
| ^~~~~~~~
Just remove this for simplicity. Since the function is also called through a callback, this does require adding a trivial wrapper with the correct prototype.
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c +13 -22
@@ -14,8 +14,7 @@#include "s5p_mfc_opr.h" #include "s5p_mfc_cmd_v6.h" -static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd, -const struct s5p_mfc_cmd_args *args) +static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd) {mfc_debug (2 ,"Issue the command: %d\n" , cmd);
@@ -31,7 +30,6 @@ static int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd,static int s5p_mfc_sys_init_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args;const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;int ret;
@@ -41,33 +39,23 @@ static int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev)mfc_write (dev, dev->ctx_buf.dma,S5P_FIMV_CONTEXT_MEM_ADDR_V6 );mfc_write (dev, buf_size->dev_ctx,S5P_FIMV_CONTEXT_MEM_SIZE_V6 ); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SYS_INIT_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SYS_INIT_V6 ); }static int s5p_mfc_sleep_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args; - -memset (&h2r_args,0 ,sizeof (struct s5p_mfc_cmd_args )); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SLEEP_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SLEEP_V6 ); }static int s5p_mfc_wakeup_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args; - -memset (&h2r_args,0 ,sizeof (struct s5p_mfc_cmd_args )); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_WAKEUP_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_WAKEUP_V6 ); }/* Open a new instance and get its number */ static int s5p_mfc_open_inst_cmd_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_cmd_args h2r_args;int codec_type;mfc_debug (2 ,"Requested codec mode: %d\n" , ctx->codec_mode);
@@ -129,23 +117,20 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)mfc_write (dev, ctx->ctx.size,S5P_FIMV_CONTEXT_MEM_SIZE_V6 );mfc_write (dev,0 ,S5P_FIMV_D_CRC_CTRL_V6 );/* no crc */ -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_OPEN_INSTANCE_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_OPEN_INSTANCE_V6 ); }/* Close instance */ static int s5p_mfc_close_inst_cmd_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_cmd_args h2r_args;int ret =0 ; dev->curr_ctx = ctx->num;if (ctx->state !=MFCINST_FREE ) {mfc_write (dev, ctx->inst_no,S5P_FIMV_INSTANCE_ID_V6 ); ret =s5p_mfc_cmd_host2risc_v6 (dev, -S5P_FIMV_H2R_CMD_CLOSE_INSTANCE_V6 , - &h2r_args); +S5P_FIMV_H2R_CMD_CLOSE_INSTANCE_V6 ); }else { ret = -EINVAL ; }
@@ -153,9 +138,15 @@ static int s5p_mfc_close_inst_cmd_v6(struct s5p_mfc_ctx *ctx)return ret; } +static int s5p_mfc_cmd_host2risc_v6_args (struct s5p_mfc_dev *dev,int cmd, +const struct s5p_mfc_cmd_args *ignored) +{ +return s5p_mfc_cmd_host2risc_v6 (dev, cmd); +} +/* Initialize cmd function pointers for MFC v6 */ static const struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = { - .cmd_host2risc = s5p_mfc_cmd_host2risc_v6, + .cmd_host2risc = s5p_mfc_cmd_host2risc_v6_args, .sys_init_cmd = s5p_mfc_sys_init_cmd_v6, .sleep_cmd = s5p_mfc_sleep_cmd_v6, .wakeup_cmd = s5p_mfc_wakeup_cmd_v6,
Sasha Levin
maintainerPATCH 1/5 media: s5p-mfc: constify fw_name strings
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit dd761d3cf4d518db197c8e03e3447ddfdccdb27e ]
Constify stored pointers to firmware names for code safety. These are not modified by the driver.
Stable-dep-of: 7fa37ba25a1d ("media: s5p-mfc: remove an unused/uninitialized variable")
--- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +1 -1
@@ -227,7 +227,7 @@ struct s5p_mfc_variant {unsigned int port_num;u32 version_bit;struct s5p_mfc_buf_size *buf_size; -char *fw_name[MFC_FW_MAX_VERSIONS ]; +const char *fw_name[MFC_FW_MAX_VERSIONS ];const char *clk_names[MFC_MAX_CLOCKS ];int num_clocks;bool use_clock_gating;
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 2/5 media: s5p-mfc: constify s5p_mfc_buf_size structures
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit e8cc4c0bc2a660fed4ad57be6635d88ccc490a05 ]
Static "s5p_mfc_buf_size*" structures are not modified by the driver, so they can be made const for code safety.
Stable-dep-of: 7fa37ba25a1d ("media: s5p-mfc: remove an unused/uninitialized variable")
--- .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 20 +++++++++---------- .../platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 2 +- .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 ++-- .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 2 +- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 6 +++--- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +10 -10
@@ -1503,14 +1503,14 @@ static const struct dev_pm_ops s5p_mfc_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (s5p_mfc_suspend, s5p_mfc_resume) }; -static struct s5p_mfc_buf_size_v5 mfc_buf_size_v5 = { +static const struct s5p_mfc_buf_size_v5 mfc_buf_size_v5 = { .h264_ctx =MFC_H264_CTX_BUF_SIZE , .non_h264_ctx =MFC_CTX_BUF_SIZE , .dsc =DESC_BUF_SIZE , .shm =SHARED_BUF_SIZE , }; -static struct s5p_mfc_buf_size buf_size_v5 = { +static const struct s5p_mfc_buf_size buf_size_v5 = { .fw =MAX_FW_SIZE , .cpb =MAX_CPB_SIZE , .priv = &mfc_buf_size_v5,
@@ -1527,7 +1527,7 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = { .use_clock_gating = true, }; -static struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = { +static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = { .dev_ctx =MFC_CTX_BUF_SIZE_V6 , .h264_dec_ctx =MFC_H264_DEC_CTX_BUF_SIZE_V6 , .other_dec_ctx =MFC_OTHER_DEC_CTX_BUF_SIZE_V6 ,
@@ -1535,7 +1535,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = { .other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V6, }; -static struct s5p_mfc_buf_size buf_size_v6 = { +static const struct s5p_mfc_buf_size buf_size_v6 = { .fw =MAX_FW_SIZE_V6 , .cpb =MAX_CPB_SIZE_V6 , .priv = &mfc_buf_size_v6,
@@ -1556,7 +1556,7 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = { .num_clocks = 1, }; -static struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = { +static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = { .dev_ctx =MFC_CTX_BUF_SIZE_V7 , .h264_dec_ctx =MFC_H264_DEC_CTX_BUF_SIZE_V7 , .other_dec_ctx =MFC_OTHER_DEC_CTX_BUF_SIZE_V7 ,
@@ -1564,7 +1564,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = { .other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V7, }; -static struct s5p_mfc_buf_size buf_size_v7 = { +static const struct s5p_mfc_buf_size buf_size_v7 = { .fw =MAX_FW_SIZE_V7 , .cpb =MAX_CPB_SIZE_V7 , .priv = &mfc_buf_size_v7,
@@ -1590,7 +1590,7 @@ static struct s5p_mfc_variant mfc_drvdata_v7_3250 = { .num_clocks = 2, }; -static struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = { +static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = { .dev_ctx =MFC_CTX_BUF_SIZE_V8 , .h264_dec_ctx =MFC_H264_DEC_CTX_BUF_SIZE_V8 , .other_dec_ctx =MFC_OTHER_DEC_CTX_BUF_SIZE_V8 ,
@@ -1598,7 +1598,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = { .other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V8, }; -static struct s5p_mfc_buf_size buf_size_v8 = { +static const struct s5p_mfc_buf_size buf_size_v8 = { .fw =MAX_FW_SIZE_V8 , .cpb =MAX_CPB_SIZE_V8 , .priv = &mfc_buf_size_v8,
@@ -1624,7 +1624,7 @@ static struct s5p_mfc_variant mfc_drvdata_v8_5433 = { .num_clocks = 3, }; -static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = { +static const struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = { .dev_ctx =MFC_CTX_BUF_SIZE_V10 , .h264_dec_ctx =MFC_H264_DEC_CTX_BUF_SIZE_V10 , .other_dec_ctx =MFC_OTHER_DEC_CTX_BUF_SIZE_V10 ,
@@ -1633,7 +1633,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = { .other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V10, }; -static struct s5p_mfc_buf_size buf_size_v10 = { +static const struct s5p_mfc_buf_size buf_size_v10 = { .fw =MAX_FW_SIZE_V10 , .cpb =MAX_CPB_SIZE_V10 , .priv = &mfc_buf_size_v10,
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c +1 -1
@@ -32,7 +32,7 @@ static int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd,static int s5p_mfc_sys_init_cmd_v6 (struct s5p_mfc_dev *dev) {struct s5p_mfc_cmd_args h2r_args; -struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv; +const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;int ret; ret =s5p_mfc_hw_call (dev->mfc_ops, alloc_dev_context_buffer, dev);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +2 -2
@@ -219,14 +219,14 @@ struct s5p_mfc_buf_size_v6 {struct s5p_mfc_buf_size {unsigned int fw;unsigned int cpb; -void *priv; +const void *priv; };struct s5p_mfc_variant {unsigned int version;unsigned int port_num;u32 version_bit; -struct s5p_mfc_buf_size *buf_size; +const struct s5p_mfc_buf_size *buf_size;const char *fw_name[MFC_FW_MAX_VERSIONS ];const char *clk_names[MFC_MAX_CLOCKS ];int num_clocks;
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +1 -1
@@ -426,7 +426,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)struct s5p_mfc_ctx *ctx =fh_to_ctx (priv);int ret =0 ;struct v4l2_pix_format_mplane *pix_mp; -struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size; +const struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;mfc_debug_enter (); ret =vidioc_try_fmt (file, priv, f);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c +3 -3
@@ -34,7 +34,7 @@static int s5p_mfc_alloc_dec_temp_buffers_v5 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv; +const struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;int ret; ctx->dsc.size = buf_size->dsc;
@@ -200,7 +200,7 @@ static void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx)static int s5p_mfc_alloc_instance_buffer_v5 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv; +const struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;int ret; if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||
@@ -345,7 +345,7 @@ static void s5p_mfc_enc_calc_src_size_v5(struct s5p_mfc_ctx *ctx)static void s5p_mfc_set_dec_desc_buffer (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv; +const struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;mfc_write (dev,OFFSETA (ctx->dsc.dma),S5P_FIMV_SI_CH0_DESC_ADR );mfc_write (dev, buf_size->dsc,S5P_FIMV_SI_CH0_DESC_SIZE );
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +3 -3
@@ -333,7 +333,7 @@ static void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx)static int s5p_mfc_alloc_instance_buffer_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv; +const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;int ret;mfc_debug_enter ();
@@ -393,7 +393,7 @@ static void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx)/* Allocate context buffers for SYS_INIT */ static int s5p_mfc_alloc_dev_context_buffer_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv; +const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;int ret;mfc_debug_enter ();
@@ -493,7 +493,7 @@ static int s5p_mfc_set_dec_stream_buffer_v6(struct s5p_mfc_ctx *ctx, {struct s5p_mfc_dev *dev = ctx->dev;const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs; -struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size; +const struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;mfc_debug_enter (); mfc_debug(2, "inst_no: %d, buf_addr: 0x%08x,\n"
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 3/5 media: s5p-mfc: constify s5p_mfc_hw_cmds structures
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c76c43d77869adc1709693ba532fe7fb4f30aa45 ]
Static "s5p_mfc_hw_cmds" structures are not modified by the driver, so they can be made const for code safety.
Stable-dep-of: 7fa37ba25a1d ("media: s5p-mfc: remove an unused/uninitialized variable")
--- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c | 4 ++-- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h | 2 +- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 4 ++-- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h | 2 +- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c +2 -2
@@ -148,7 +148,7 @@ static int s5p_mfc_close_inst_cmd_v5(struct s5p_mfc_ctx *ctx) }/* Initialize cmd function pointers for MFC v5 */ -static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v5 = { +static const struct s5p_mfc_hw_cmds s5p_mfc_cmds_v5 = { .cmd_host2risc = s5p_mfc_cmd_host2risc_v5, .sys_init_cmd = s5p_mfc_sys_init_cmd_v5, .sleep_cmd = s5p_mfc_sleep_cmd_v5,
@@ -157,7 +157,7 @@ static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v5 = { .close_inst_cmd = s5p_mfc_close_inst_cmd_v5, }; -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5 (void ) +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5 (void ) {return &s5p_mfc_cmds_v5; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.h +1 -1
@@ -11,6 +11,6 @@#include "s5p_mfc_common.h" -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5 (void ); +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v5 (void );#endif /* S5P_MFC_CMD_H_ */
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c +2 -2
@@ -154,7 +154,7 @@ static int s5p_mfc_close_inst_cmd_v6(struct s5p_mfc_ctx *ctx) }/* Initialize cmd function pointers for MFC v6 */ -static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = { +static const struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = { .cmd_host2risc = s5p_mfc_cmd_host2risc_v6, .sys_init_cmd = s5p_mfc_sys_init_cmd_v6, .sleep_cmd = s5p_mfc_sleep_cmd_v6,
@@ -163,7 +163,7 @@ static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = { .close_inst_cmd = s5p_mfc_close_inst_cmd_v6, }; -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6 (void ) +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6 (void ) {return &s5p_mfc_cmds_v6; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.h +1 -1
@@ -11,6 +11,6 @@#include "s5p_mfc_common.h" -struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6 (void ); +const struct s5p_mfc_hw_cmds *s5p_mfc_init_hw_cmds_v6 (void );#endif /* S5P_MFC_CMD_H_ */
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +1 -1
@@ -339,7 +339,7 @@ struct s5p_mfc_dev {struct s5p_mfc_priv_buf ctx_buf;int warn_start;struct s5p_mfc_hw_ops *mfc_ops; -struct s5p_mfc_hw_cmds *mfc_cmds; +const struct s5p_mfc_hw_cmds *mfc_cmds;const struct s5p_mfc_regs *mfc_regs;enum s5p_mfc_fw_ver fw_ver;bool fw_get_done;
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 4/5 media: s5p-mfc: constify pointers to s5p_mfc_cmd_args
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 60a2a86fb8277ba2b8d26cd49222e92fea36a196 ]
In few places functions do not modify pointed "struct s5p_mfc_cmd_args", thus the pointer can point to const data for additional safety and self-documenting intention of the function.
Stable-dep-of: 7fa37ba25a1d ("media: s5p-mfc: remove an unused/uninitialized variable")
--- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd.h | 2 +- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c | 2 +- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd.h +1 -1
@@ -19,7 +19,7 @@ struct s5p_mfc_cmd_args {struct s5p_mfc_hw_cmds {int (*cmd_host2risc)(struct s5p_mfc_dev *dev,int cmd, -struct s5p_mfc_cmd_args *args); +const struct s5p_mfc_cmd_args *args);int (*sys_init_cmd)(struct s5p_mfc_dev *dev);int (*sleep_cmd)(struct s5p_mfc_dev *dev);int (*wakeup_cmd)(struct s5p_mfc_dev *dev);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v5.c +1 -1
@@ -14,7 +14,7 @@/* This function is used to send a command to the MFC */ static int s5p_mfc_cmd_host2risc_v5 (struct s5p_mfc_dev *dev,int cmd, -struct s5p_mfc_cmd_args *args) +const struct s5p_mfc_cmd_args *args) {int cur_cmd;unsigned long timeout;
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c +1 -1
@@ -15,7 +15,7 @@#include "s5p_mfc_cmd_v6.h" static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd, -struct s5p_mfc_cmd_args *args) +const struct s5p_mfc_cmd_args *args) {mfc_debug (2 ,"Issue the command: %d\n" , cmd);
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 5/5 media: s5p-mfc: remove an unused/uninitialized variable
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7fa37ba25a1dfc084e24ea9acc14bf1fad8af14c ]
The s5p_mfc_cmd_args structure in the v6 driver is never used, not initialized to anything other than zero, but as of clang-21 this causes a warning:
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c:45:7: error: variable 'h2r_args' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
45 | &h2r_args);
| ^~~~~~~~
Just remove this for simplicity. Since the function is also called through a callback, this does require adding a trivial wrapper with the correct prototype.
--- .../platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-)
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c +13 -22
@@ -14,8 +14,7 @@#include "s5p_mfc_opr.h" #include "s5p_mfc_cmd_v6.h" -static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd, -const struct s5p_mfc_cmd_args *args) +static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd) {mfc_debug (2 ,"Issue the command: %d\n" , cmd);
@@ -31,7 +30,6 @@ static int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd,static int s5p_mfc_sys_init_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args;const struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;int ret;
@@ -41,33 +39,23 @@ static int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev)mfc_write (dev, dev->ctx_buf.dma,S5P_FIMV_CONTEXT_MEM_ADDR_V6 );mfc_write (dev, buf_size->dev_ctx,S5P_FIMV_CONTEXT_MEM_SIZE_V6 ); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SYS_INIT_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SYS_INIT_V6 ); }static int s5p_mfc_sleep_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args; - -memset (&h2r_args,0 ,sizeof (struct s5p_mfc_cmd_args )); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SLEEP_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SLEEP_V6 ); }static int s5p_mfc_wakeup_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args; - -memset (&h2r_args,0 ,sizeof (struct s5p_mfc_cmd_args )); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_WAKEUP_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_WAKEUP_V6 ); }/* Open a new instance and get its number */ static int s5p_mfc_open_inst_cmd_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_cmd_args h2r_args;int codec_type;mfc_debug (2 ,"Requested codec mode: %d\n" , ctx->codec_mode);
@@ -129,23 +117,20 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)mfc_write (dev, ctx->ctx.size,S5P_FIMV_CONTEXT_MEM_SIZE_V6 );mfc_write (dev,0 ,S5P_FIMV_D_CRC_CTRL_V6 );/* no crc */ -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_OPEN_INSTANCE_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_OPEN_INSTANCE_V6 ); }/* Close instance */ static int s5p_mfc_close_inst_cmd_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_cmd_args h2r_args;int ret =0 ; dev->curr_ctx = ctx->num;if (ctx->state !=MFCINST_FREE ) {mfc_write (dev, ctx->inst_no,S5P_FIMV_INSTANCE_ID_V6 ); ret =s5p_mfc_cmd_host2risc_v6 (dev, -S5P_FIMV_H2R_CMD_CLOSE_INSTANCE_V6 , - &h2r_args); +S5P_FIMV_H2R_CMD_CLOSE_INSTANCE_V6 ); }else { ret = -EINVAL ; }
@@ -153,9 +138,15 @@ static int s5p_mfc_close_inst_cmd_v6(struct s5p_mfc_ctx *ctx)return ret; } +static int s5p_mfc_cmd_host2risc_v6_args (struct s5p_mfc_dev *dev,int cmd, +const struct s5p_mfc_cmd_args *ignored) +{ +return s5p_mfc_cmd_host2risc_v6 (dev, cmd); +} +/* Initialize cmd function pointers for MFC v6 */ static const struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = { - .cmd_host2risc = s5p_mfc_cmd_host2risc_v6, + .cmd_host2risc = s5p_mfc_cmd_host2risc_v6_args, .sys_init_cmd = s5p_mfc_sys_init_cmd_v6, .sleep_cmd = s5p_mfc_sleep_cmd_v6, .wakeup_cmd = s5p_mfc_wakeup_cmd_v6,
Signature · 1 line
2.51.0
Greg KH
maintainerRe: [PATCH 6.1.y 1/5] media: s5p-mfc: constify fw_name strings
In reply to Sasha LevinQuoted 7 lines · Sasha Levin
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit
dd761d3cf4d518db197c8e03e3447ddfdccdb27e]Constify stored pointers to firmware names for code safety. These are not modified by the driver.
Quoted 8 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Aakarsh Jain <[email protected]>Signed-off-by Hans Verkuil <[email protected]>Stable-dep-of:
7fa37ba25a1d("media: s5p-mfc: remove an unused/uninitialized variable")Signed-off-by Sasha Levin <[email protected]>--- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I'll drop this series as the 6.6.y one did not apply.
thanks,
greg k-h