ACPI / LPSS: Make condition local to lpt_register_clock_device
PATCH 1/2 ACPI / LPSS: Make condition local to lpt_register_clock_device
It seems more logical to have the check of lpss_clk_dev variable in lpt_register_clock_device() because last one actually assignes the variable.
--- drivers/acpi/acpi_lpss.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/acpi/acpi_lpss.c +4 -2
@@ -84,6 +84,9 @@ static struct platform_device *lpss_clk_dev;static inline void lpt_register_clock_device (void ) { +if (lpss_clk_dev) +return ; + lpss_clk_dev =platform_device_register_simple ("clk-lpt" ,-1 ,NULL ,0 ); }
@@ -92,8 +95,7 @@ static int register_device_clock(struct acpi_device *adev, {const struct lpss_device_desc *dev_desc = pdata->dev_desc; -if (!lpss_clk_dev) -lpt_register_clock_device (); +lpt_register_clock_device ();if (!dev_desc->clk_parent || !pdata->mmio_base || pdata->mmio_size < dev_desc->prv_offset +LPSS_CLK_SIZE )
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 2/2 ACPI / LPSS: make code less confusing for reader
The excerpt like this:
if (err) {
err = 0;
goto error_out;
}makes a reader confused even if it's commented. Let's do necessary actions and return no error explicitly.
--- drivers/acpi/acpi_lpss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpi_lpss.c +2 -2
@@ -152,8 +152,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,* Skip the device, but don't terminate the namespace * scan. */ - ret =0 ; - goto err_out; +kfree (pdata); +return 0 ; } }
Signature · 1 line
1.8.2.rc0.22.gb3600c3
Rafael J. Wysocki
AppliedRe: [PATCH 2/2] ACPI / LPSS: make code less confusing for reader
Quoted 11 lines · Andy Shevchenko
The excerpt like this:
if (err) { err = 0; goto error_out; }makes a reader confused even if it's commented. Let's do necessary actions and return no error explicitly.
Signed-off-by Andy Shevchenko <[email protected]>
Applied to linux-pm.git/linux-next.
Thanks,
Rafael
Quoted 20 lines
--- drivers/acpi/acpi_lpss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +2
-2@@ -152,8 +152,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,* Skip the device, but don't terminate the namespace * scan. */ - ret =0 ; - goto err_out; +kfree (pdata); +return 0 ; } }
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 4 lines · Andy Shevchenko
It seems more logical to have the check of
lpss_clk_devvariable inlpt_register_clock_device()because last one actually assignes the variable.Signed-off-by Andy Shevchenko <[email protected]>
Actually, I came to the opposite conclusion when I was working on the code in question. :-)
Not applied.
Thanks,
Rafael
Quoted 29 lines
--- drivers/acpi/acpi_lpss.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/acpi/acpi_lpss.c +4
-2@@ -84,6 +84,9 @@ static struct platform_device *lpss_clk_dev;static inline void lpt_register_clock_device (void ) { +if (lpss_clk_dev) +return ; + lpss_clk_dev =platform_device_register_simple ("clk-lpt" ,-1 ,NULL ,0 ); }@@ -92,8 +95,7 @@ static int register_device_clock(struct acpi_device *adev, {const struct lpss_device_desc *dev_desc = pdata->dev_desc; -if (!lpss_clk_dev) -lpt_register_clock_device (); +lpt_register_clock_device ();if (!dev_desc->clk_parent || !pdata->mmio_base || pdata->mmio_size < dev_desc->prv_offset +LPSS_CLK_SIZE )
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.