Skip to contentSkip to conversation

acpi/arm64: remove unnecessary cast

PATCH Applied Min-Hua Chen 3 participants 4 messages Sep 17, 2024 – Nov 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi/arm64: remove unnecessary cast

DEFINE_RES_IRQ returns struct resource type, so it is unnecessary to cast it to struct resource.

Remove the unnecessary cast to fix the following sparse warnings:

drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast to non-scalar drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast from non-scalar

No functional changes intended.

---
 drivers/acpi/arm64/gtdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/gtdt.c +1 -1
index c0e77c1c8e09..24bd479de91f 100644
@@ -352,7 +352,7 @@ static int __init gtdt_import_sbsa_gwdt(struct acpi_gtdt_watchdog *wd,
 	}
 
 	irq = map_gt_gsi(wd->timer_interrupt, wd->timer_flags);
-	res[2] = (struct resource)DEFINE_RES_IRQ(irq);
+	res[2] = DEFINE_RES_IRQ(irq);
 	if (irq <= 0) {
 		pr_warn("failed to map the Watchdog interrupt.\n");
 		nr_res--;
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · Min-Hua Chen

DEFINE_RES_IRQ returns struct resource type, so it is unnecessary to cast it to struct resource.

Remove the unnecessary cast to fix the following sparse warnings:

drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast to non-scalar drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast from non-scalar

No functional changes intended.

---
  drivers/acpi/arm64/gtdt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/gtdt.c +0 -0
index c0e77c1c8e09..24bd479de91f 100644

drivers/acpi/arm64/gtdt.c static int __init gtdt_import_sbsa_gwdt(struct acpi_gtdt_watchdog *wd, · line 358

Quoted 8 lines
drivers/acpi/arm64/gtdt.c +1 -1
@@ -352,7 +352,7 @@ static int __init gtdt_import_sbsa_gwdt(struct acpi_gtdt_watchdog *wd,
  	}
 
  	irq = map_gt_gsi(wd->timer_interrupt, wd->timer_flags);
-	res[2] = (struct resource)DEFINE_RES_IRQ(irq);
+	res[2] = DEFINE_RES_IRQ(irq);
  	if (irq <= 0) {
  		pr_warn("failed to map the Watchdog interrupt.\n");
  		nr_res--;

It's a minor issue, but I think it deserves a patch to make the code cleaner,

Thanks
Hanjun

maintainer
#2 lore raw
Quoted 34 lines · Hanjun Guo
Quoted 21 lines · Min-Hua Chen

DEFINE_RES_IRQ returns struct resource type, so it is unnecessary to cast it to struct resource.

Remove the unnecessary cast to fix the following sparse warnings:

drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast to non-scalar drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast from non-scalar

No functional changes intended.

---
  drivers/acpi/arm64/gtdt.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/arm64/gtdt.c +0 -0
index c0e77c1c8e09..24bd479de91f 100644

drivers/acpi/arm64/gtdt.c static int __init gtdt_import_sbsa_gwdt(struct · line 358

Quoted 8 lines
drivers/acpi/arm64/gtdt.c +1 -1
@@ -352,7 +352,7 @@ static int __init gtdt_import_sbsa_gwdt(struct 
 acpi_gtdt_watchdog *wd,
       }
       irq = map_gt_gsi(wd->timer_interrupt, wd->timer_flags);
-    res[2] = (struct resource)DEFINE_RES_IRQ(irq);
+    res[2] = DEFINE_RES_IRQ(irq);
       if (irq <= 0) {
           pr_warn("failed to map the Watchdog interrupt.\n");
           nr_res--;

It's a minor issue, but I think it deserves a patch to make the code cleaner,

Quoted 1 line

Lorenzo, Sudeep, please take a look at this patch.

Thanks
Hanjun

maintainer Applied
#3 lore raw
In reply to Min-Hua Chen
Quoted 9 lines · Min-Hua Chen

DEFINE_RES_IRQ returns struct resource type, so it is unnecessary to cast it to struct resource.

Remove the unnecessary cast to fix the following sparse warnings:

drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast to non-scalar drivers/acpi/arm64/gtdt.c:355:19: sparse: warning: cast from non-scalar

[...]

Applied to arm64 (for-next/misc), thanks!

[1/1] acpi/arm64: remove unnecessary cast

      https://git.kernel.org/arm64/c/f95382d73ec8
Signature · 1 line
Catalin