]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: core: Fix variable shadowing in mmc_route_rpmb_frames()
authorBean Huo <beanhuo@micron.com>
Thu, 11 Sep 2025 21:06:05 +0000 (23:06 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 12 Sep 2025 13:09:53 +0000 (15:09 +0200)
Rename the inner 'frm' variable to 'resp_frm' in the write path of
mmc_route_rpmb_frames() to avoid shadowing the outer 'frm' variable.

The function declares 'frm' at function scope pointing to the request
frame, but then redeclares another 'frm' variable inside the write
block pointing to the response frame. This shadowing makes the code
confusing and error-prone.

Using 'resp_frm' for the response frame makes the distinction clear
and improves code readability.

Fixes: 7852028a35f0 ("mmc: block: register RPMB partition with the RPMB subsystem")
Reviewed-by: Avri Altman <avri.altman@sandisk.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/block.c

index 8fd9891462054da8c00bdbb93e3414614441644d..e14820cde252918816f25e35cc6b77eaeb99fd81 100644 (file)
@@ -2930,15 +2930,15 @@ static int mmc_route_rpmb_frames(struct device *dev, u8 *req,
                return -ENOMEM;
 
        if (write) {
-               struct rpmb_frame *frm = (struct rpmb_frame *)resp;
+               struct rpmb_frame *resp_frm = (struct rpmb_frame *)resp;
 
                /* Send write request frame(s) */
                set_idata(idata[0], MMC_WRITE_MULTIPLE_BLOCK,
                          1 | MMC_CMD23_ARG_REL_WR, req, req_len);
 
                /* Send result request frame */
-               memset(frm, 0, sizeof(*frm));
-               frm->req_resp = cpu_to_be16(RPMB_RESULT_READ);
+               memset(resp_frm, 0, sizeof(*resp_frm));
+               resp_frm->req_resp = cpu_to_be16(RPMB_RESULT_READ);
                set_idata(idata[1], MMC_WRITE_MULTIPLE_BLOCK, 1, resp,
                          resp_len);