Skip to contentSkip to conversation

cxl/mbox: Remove useless cast in cxl_mem_create_range_info()

PATCH In review [email protected] 5 participants 5 messages Aug 15, 2023 – Aug 23, 2023 CXL

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v2 1/1 cxl/mbox: Remove useless cast in cxl_mem_create_range_info()

From: Alison Schofield <[email protected]>

DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro which already has the (struct resource) for the compound literal. The user of the macro should not repeat the cast.

Cleans up these sparse warnings:
drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

Fixes 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")

---

Changes in v2:
- Update commit log (Andy)
- Add fixes tag (Jonathan)

 drivers/cxl/core/mbox.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cxl/core/mbox.c +1 -2
index d6d067fbee97..01de4b438b2a 100644
@@ -1180,8 +1180,7 @@ int cxl_mem_create_range_info(struct cxl_memdev_state *mds)
 		return 0;
 	}
 
-	cxlds->dpa_res =
-		(struct resource)DEFINE_RES_MEM(0, mds->total_bytes);
+	cxlds->dpa_res = DEFINE_RES_MEM(0, mds->total_bytes);
 
 	if (mds->partition_align_bytes == 0) {
 		rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,

base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9

Signature · 1 line
2.37.3
#1 lore raw
Quoted 6 lines · alison.schofield@ wrote:

From: Alison Schofield <[email protected]>

DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro which already has the (struct resource) for the compound literal. The user of the macro should not repeat the cast.

Quoted 6 lines

Cleans up these sparse warnings:
drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

Fixes 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")

Looks good to me.

Reviewed-by on v2 1/1
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Tue, Aug 15, 2023 at 10:20:52AM -0700, [email protected] wrote:

From: Alison Schofield <[email protected]>

DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro which already has the (struct resource) for the compound literal. The user of the macro should not repeat the cast.

s/repeat/use/

Quoted 3 lines

Cleans up these sparse warnings:
drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

With the above fixed,

Thank you!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Reviewed-by on v2 1/1
#3 lore raw
In reply to [email protected]
Quoted 6 lines · On Tue, 15 Aug 2023, [email protected] wrote:

From: Alison Schofield <[email protected]>

DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro which already has the (struct resource) for the compound literal. The user of the macro should not repeat the cast.

Quoted 6 lines

Cleans up these sparse warnings:
drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

Fixes 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
Reviewed-by on v2 1/1
#4 lore raw
In reply to [email protected]
Quoted 6 lines · On Tue, 15 Aug 2023 10:20:52 -0700 [email protected] wrote:

From: Alison Schofield <[email protected]>

DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro which already has the (struct resource) for the compound literal. The user of the macro should not repeat the cast.

Quoted 6 lines

Cleans up these sparse warnings:
drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

Fixes 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
Quoted 25 lines

---

Changes in v2:
- Update commit log (Andy)
- Add fixes tag (Jonathan)

 drivers/cxl/core/mbox.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/cxl/core/mbox.c +1 -2
index d6d067fbee97..01de4b438b2a 100644
@@ -1180,8 +1180,7 @@ int cxl_mem_create_range_info(struct cxl_memdev_state *mds)
 		return 0;
 	}
 
-	cxlds->dpa_res =
-		(struct resource)DEFINE_RES_MEM(0, mds->total_bytes);
+	cxlds->dpa_res = DEFINE_RES_MEM(0, mds->total_bytes);
 
 	if (mds->partition_align_bytes == 0) {
 		rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,

base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9