Skip to content

Commit 072755c

Browse files
beanhuoUlf Hansson
authored andcommitted
mmc: core: Fix variable shadowing in mmc_route_rpmb_frames()
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: 7852028 ("mmc: block: register RPMB partition with the RPMB subsystem") Reviewed-by: Avri Altman <[email protected]> Reviewed-by: Jens Wiklander <[email protected]> Signed-off-by: Bean Huo <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent f338529 commit 072755c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/mmc/core/block.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,15 +2930,15 @@ static int mmc_route_rpmb_frames(struct device *dev, u8 *req,
29302930
return -ENOMEM;
29312931

29322932
if (write) {
2933-
struct rpmb_frame *frm = (struct rpmb_frame *)resp;
2933+
struct rpmb_frame *resp_frm = (struct rpmb_frame *)resp;
29342934

29352935
/* Send write request frame(s) */
29362936
set_idata(idata[0], MMC_WRITE_MULTIPLE_BLOCK,
29372937
1 | MMC_CMD23_ARG_REL_WR, req, req_len);
29382938

29392939
/* Send result request frame */
2940-
memset(frm, 0, sizeof(*frm));
2941-
frm->req_resp = cpu_to_be16(RPMB_RESULT_READ);
2940+
memset(resp_frm, 0, sizeof(*resp_frm));
2941+
resp_frm->req_resp = cpu_to_be16(RPMB_RESULT_READ);
29422942
set_idata(idata[1], MMC_WRITE_MULTIPLE_BLOCK, 1, resp,
29432943
resp_len);
29442944

0 commit comments

Comments
 (0)