Skip to contentSkip to conversation

platform/x86: sony-laptop: Fix unintentional fall-through

PATCH In review Gustavo A. R. Silva 3 participants 5 messages Apr 24, 2019 – May 6, 2019

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

PATCH 1/1 platform/x86: sony-laptop: Fix unintentional fall-through

It seems that the default case should return AE_CTRL_TERMINATE, instead of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK; otherwise the line of code at the end of the function is unreachable and makes no sense:

return AE_CTRL_TERMINATE;

This fix is based on the following thread of discussion:

https://lore.kernel.org/patchwork/patch/959782/

Fixes 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
---
 drivers/platform/x86/sony-laptop.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -3
index 4bfbfa3f78e6..2058445fc456 100644
@@ -4424,14 +4424,16 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
 			}
 			return AE_OK;
 		}
+
+	case ACPI_RESOURCE_TYPE_END_TAG:
+		return AE_OK;
+
 	default:
 		dprintk("Resource %d isn't an IRQ nor an IO port\n",
 			resource->type);
+		return AE_CTRL_TERMINATE;
 
-	case ACPI_RESOURCE_TYPE_END_TAG:
-		return AE_OK;
 	}
-	return AE_CTRL_TERMINATE;
 }
 
 static int sony_pic_possible_resources(struct acpi_device *device)
Signature · 1 line
2.21.0
#1 lore raw

Hi all,

Friendly ping:

Who can take this?

Thanks
--
Gustavo

Quoted 43 lines · Gustavo A. R. Silva

It seems that the default case should return AE_CTRL_TERMINATE, instead of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK; otherwise the line of code at the end of the function is unreachable and makes no sense:

return AE_CTRL_TERMINATE;

This fix is based on the following thread of discussion:

https://lore.kernel.org/patchwork/patch/959782/

Fixes 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
---
 drivers/platform/x86/sony-laptop.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -3
index 4bfbfa3f78e6..2058445fc456 100644
@@ -4424,14 +4424,16 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
 			}
 			return AE_OK;
 		}
+
+	case ACPI_RESOURCE_TYPE_END_TAG:
+		return AE_OK;
+
 	default:
 		dprintk("Resource %d isn't an IRQ nor an IO port\n",
 			resource->type);
+		return AE_CTRL_TERMINATE;
 
-	case ACPI_RESOURCE_TYPE_END_TAG:
-		return AE_OK;
 	}
-	return AE_CTRL_TERMINATE;
 }
 
 static int sony_pic_possible_resources(struct acpi_device *device)
#2 lore raw
Quoted 6 lines · Gustavo A. R. Silva

Hi all,

Friendly ping:

Who can take this?

Pushed to my review and testing queue, thanks!

Quoted 49 lines

Thanks
--
Gustavo

Quoted 43 lines · Gustavo A. R. Silva

It seems that the default case should return AE_CTRL_TERMINATE, instead of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK; otherwise the line of code at the end of the function is unreachable and makes no sense:

return AE_CTRL_TERMINATE;

This fix is based on the following thread of discussion:

https://lore.kernel.org/patchwork/patch/959782/

Fixes 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
---
 drivers/platform/x86/sony-laptop.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -3
index 4bfbfa3f78e6..2058445fc456 100644
@@ -4424,14 +4424,16 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
                      }
                      return AE_OK;
              }
+
+     case ACPI_RESOURCE_TYPE_END_TAG:
+             return AE_OK;
+
      default:
              dprintk("Resource %d isn't an IRQ nor an IO port\n",
                      resource->type);
+             return AE_CTRL_TERMINATE;
 
-     case ACPI_RESOURCE_TYPE_END_TAG:
-             return AE_OK;
      }
-     return AE_CTRL_TERMINATE;
 }
 
 static int sony_pic_possible_resources(struct acpi_device *device)
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 6 lines · Gustavo A. R. Silva

Hi all,

Friendly ping:

Who can take this?

Pushed to my review and testing queue, thanks!

Awesome. :)

Thanks, Andy.
--
Gustavo

Quoted 53 lines
Quoted 50 lines

Thanks
--
Gustavo

Quoted 43 lines · Gustavo A. R. Silva

It seems that the default case should return AE_CTRL_TERMINATE, instead of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK; otherwise the line of code at the end of the function is unreachable and makes no sense:

return AE_CTRL_TERMINATE;

This fix is based on the following thread of discussion:

https://lore.kernel.org/patchwork/patch/959782/

Fixes 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
---
 drivers/platform/x86/sony-laptop.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -3
index 4bfbfa3f78e6..2058445fc456 100644
@@ -4424,14 +4424,16 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
                      }
                      return AE_OK;
              }
+
+     case ACPI_RESOURCE_TYPE_END_TAG:
+             return AE_OK;
+
      default:
              dprintk("Resource %d isn't an IRQ nor an IO port\n",
                      resource->type);
+             return AE_CTRL_TERMINATE;
 
-     case ACPI_RESOURCE_TYPE_END_TAG:
-             return AE_OK;
      }
-     return AE_CTRL_TERMINATE;
 }
 
 static int sony_pic_possible_resources(struct acpi_device *device)
Reviewed-by on v1 1/1
#4 lore raw
In reply to Gustavo A. R. Silva
Quoted 8 lines · Gustavo A. R. Silva

It seems that the default case should return AE_CTRL_TERMINATE, instead of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK; otherwise the line of code at the end of the function is unreachable and makes no sense:

return AE_CTRL_TERMINATE;

Quoted 7 lines

This fix is based on the following thread of discussion:

https://lore.kernel.org/patchwork/patch/959782/

Fixes 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")

-Kees

Quoted 31 lines
---
 drivers/platform/x86/sony-laptop.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -4
index 4bfbfa3f78e6..2058445fc456 100644
@@ -4424,14 +4424,16 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
                        }
                        return AE_OK;
                }
+
+       case ACPI_RESOURCE_TYPE_END_TAG:
+               return AE_OK;
+
        default:
                dprintk("Resource %d isn't an IRQ nor an IO port\n",
                        resource->type);
+               return AE_CTRL_TERMINATE;
 
-       case ACPI_RESOURCE_TYPE_END_TAG:
-               return AE_OK;
        }
-       return AE_CTRL_TERMINATE;
 }
 
 static int sony_pic_possible_resources(struct acpi_device *device)
--

2.21.0

Signature · 1 line
Kees Cook