[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ecaae46b-5ba5-3c08-2451-34d0dba46143@samsung.com>
Date: Wed, 24 Jun 2020 10:16:07 +0200
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Cc: linux-pm@...r.kernel.org, linux-acpi@...r.kernel.org,
netdev@...r.kernel.org, linux-wireless@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org,
linux-rockchip@...ts.infradead.org,
"Rafael J . Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
Vishal Kulkarni <vishal@...lsio.com>,
"David S . Miller" <davem@...emloft.net>,
Jiri Pirko <jiri@...lanox.com>,
Ido Schimmel <idosch@...lanox.com>,
Johannes Berg <johannes.berg@...el.com>,
Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
Luca Coelho <luciano.coelho@...el.com>,
Intel Linux Wireless <linuxwifi@...el.com>,
Kalle Valo <kvalo@...eaurora.org>,
Peter Kaestle <peter@...e.net>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Sebastian Reichel <sre@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amit.kucheria@...durent.com>,
Support Opensource <support.opensource@...semi.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Heiko Stuebner <heiko@...ech.de>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang7@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Zhang Rui <rui.zhang@...el.com>,
Allison Randal <allison@...utok.net>,
Enrico Weigelt <info@...ux.net>,
Gayatri Kammela <gayatri.kammela@...el.com>,
Thomas Gleixner <tglx@...utronix.de>, kernel@...labora.com
Subject: Re: [PATCH v4 01/11] acpi: thermal: Fix error handling in the
register function
On 5/28/20 9:20 PM, Andrzej Pietrasiewicz wrote:
> The acpi_thermal_register_thermal_zone() is missing any error handling.
> This needs to be fixed.
>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@...labora.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/acpi/thermal.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 19067a5e5293..6de8066ca1e7 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -901,23 +901,35 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
> result = sysfs_create_link(&tz->device->dev.kobj,
> &tz->thermal_zone->device.kobj, "thermal_zone");
> if (result)
> - return result;
> + goto unregister_tzd;
>
> result = sysfs_create_link(&tz->thermal_zone->device.kobj,
> &tz->device->dev.kobj, "device");
> if (result)
> - return result;
> + goto remove_tz_link;
>
> status = acpi_bus_attach_private_data(tz->device->handle,
> tz->thermal_zone);
> - if (ACPI_FAILURE(status))
> - return -ENODEV;
> + if (ACPI_FAILURE(status)) {
> + result = -ENODEV;
> + goto remove_dev_link;
> + }
>
> tz->tz_enabled = 1;
>
> dev_info(&tz->device->dev, "registered as thermal_zone%d\n",
> tz->thermal_zone->id);
> +
> return 0;
> +
> +remove_dev_link:
> + sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
> +remove_tz_link:
> + sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
> +unregister_tzd:
> + thermal_zone_device_unregister(tz->thermal_zone);
> +
> + return result;
> }
>
> static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
>
Powered by blists - more mailing lists