Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp604102ybm; Fri, 29 May 2020 07:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKYCNh6E9RQdmfV1M1QUpMbT0yzfQpFBD8Ygo+nrvMYDITkH4medeN6A9A94sQM4qn/zQW X-Received: by 2002:a17:906:f74a:: with SMTP id jp10mr1786519ejb.43.1590763979919; Fri, 29 May 2020 07:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590763979; cv=none; d=google.com; s=arc-20160816; b=B/+yGZOVrlvHQ2pMspcmxvvzOluNX8/plGIOh2Fw3eoo5OiK/4EMm5RLxH1jEK+n3O kgkJpUHhU2sJOnByBRw+Qt1ZZLHy4CZSvrlkvFIokQw/Po6vc1RV1g2yFyGxgnEl3tQL XODRsUmPoJjgDqLPb4ZzK4svWb9/bl/YN2QI9APmeK5yzUSVA+ONX4y8sTbwCl22SGf0 2Q6iT9/q2QqHby3aHbZTujY5yPk4xogbl03hgFmSzAcmYPQWgV6xWL5qbJMNqla+Tchl hKUezzV76NmHpqZTHagJjWO9xeEge7zSPOMlR/vn7TLE0V9JKuIeWxWJ4QHOZcp9AjdD ANXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ckAKropeOCUm1zmt0HIr3BWF9IN5QnUNbPwdDc91gQM=; b=J24k8Uygv5G8FZCmtuiCCgTDtuYeoGon+eesyu/kUQ+UzNplBwb2PDI0MhIlblHkdz QxaMRItPTTRdQ8cgYOz9VSwZtkYboKbcNnGg5GaJBVpWdW1+wLAiu8k8aD/Hrxpf/vUr 1cHdU/S+RLm1y3z+Y8ohZQ7hmCJwCbukN9KUdw8U1N25l12LwiPZyWjq5k1r12xQq902 aQk6EKuyEoYcUUAiG7hufnhamxbZH9eAVbRikPQHpuYehQxBKFtoW+EhASQKBw0jVcKL zJ58uwZHazxxkaQcc1+TgtpmEg8YECWXFd/AStwbNd7OZDRIO7+47Ji3ixmRpWKFlMIP 3XAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VApd29jC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si5858587edk.449.2020.05.29.07.52.35; Fri, 29 May 2020 07:52:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VApd29jC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727087AbgE2OuR (ORCPT + 99 others); Fri, 29 May 2020 10:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726838AbgE2OuQ (ORCPT ); Fri, 29 May 2020 10:50:16 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD75C03E969; Fri, 29 May 2020 07:50:15 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id z15so3197369pjb.0; Fri, 29 May 2020 07:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ckAKropeOCUm1zmt0HIr3BWF9IN5QnUNbPwdDc91gQM=; b=VApd29jCPL4t/dmJjYuL4RaTRnmPGPnedoBqJignh4pwfT+adxmEfTg6KII8hVU3+y P+HgN3s66RdiqfaK5p5d5Yb+BT/bbTfelEz53DfeySa6BOi8Nz7ffDOzXCWc89PjESDx j6npuyY26G43teVevipd+CCGm4HtCtJrWRFgp4B5iTes87Z/DOyGYha+cTN2aS6Yq7+g UIcmEP7iCNmgbhNY34/sjXKt1JDcShF6tnfO6arWC71pCNhSjMtPj7a+U0UGOqyJbLTn eXE2kLLF08hY0We0hSvVFKsCyOel7J8thLG3PvUb5jL/2Zf8PvzV6kVN8vl8lNQ2kvTd uw2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ckAKropeOCUm1zmt0HIr3BWF9IN5QnUNbPwdDc91gQM=; b=Ro0Z7dKA/vW9+GESF3bpxdJpnI9qUr/aK+oiwkKtCHZq5eSEhvTAemaiZdH7EnmKLF s65CbNuHUwh312KwJ4OpYb5l/j6rNJam9mUkx2tfbqTEstx84Td+a4Ecm7hpARydi9yj 24b2a3VamncBCgOkvcMleFhK86+IaQHaddxYn8vhXhsdae8T4zfHKPtcyYmH0fOFgJmu kRRFadJCkOoiAvd6Zs+JtVFV+L8Mz7YENBXMtDaa4DqFhqZlU859V/RTNTsqOZTpOjYg mmI9CVJwMCwBWvaIV4mIMKH4AILbWVUnXUomNVl8ir/+zCFtQeEK269+CEDOFl4DWcVn L5Sg== X-Gm-Message-State: AOAM533YGeGnWJQ1KOD5kEP+6wIQDvGOgBkYSG0/bNqW0RNbkKCz9QTe 7TNpOk2kG+RSfaP5aZZGwUMJoxqSjpE= X-Received: by 2002:a17:90a:4805:: with SMTP id a5mr4970593pjh.22.1590763815238; Fri, 29 May 2020 07:50:15 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 140sm4674978pfy.95.2020.05.29.07.50.14 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 May 2020 07:50:14 -0700 (PDT) Date: Fri, 29 May 2020 07:50:13 -0700 From: Guenter Roeck To: Andrzej Pietrasiewicz Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Emmanuel Grumbach , Heiko Stuebner , "Rafael J . Wysocki" , Vishal Kulkarni , Luca Coelho , Miquel Raynal , kernel@collabora.com, Fabio Estevam , Amit Kucheria , Chunyan Zhang , Daniel Lezcano , Allison Randal , NXP Linux Team , Darren Hart , Zhang Rui , Gayatri Kammela , Len Brown , Johannes Berg , Intel Linux Wireless , Sascha Hauer , Ido Schimmel , Baolin Wang , Jiri Pirko , Orson Zhai , Thomas Gleixner , Kalle Valo , Support Opensource , Enrico Weigelt , Peter Kaestle , Sebastian Reichel , Bartlomiej Zolnierkiewicz , Pengutronix Kernel Team , Niklas =?iso-8859-1?Q?S=F6derlund?= , Shawn Guo , "David S . Miller" , Andy Shevchenko Subject: Re: [PATCH v4 01/11] acpi: thermal: Fix error handling in the register function Message-ID: <20200529145013.GA125062@roeck-us.net> References: <4493c0e4-51aa-3907-810c-74949ff27ca4@samsung.com> <20200528192051.28034-1-andrzej.p@collabora.com> <20200528192051.28034-2-andrzej.p@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200528192051.28034-2-andrzej.p@collabora.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, May 28, 2020 at 09:20:41PM +0200, Andrzej Pietrasiewicz wrote: > The acpi_thermal_register_thermal_zone() is missing any error handling. > This needs to be fixed. > > Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Guenter Roeck > --- > 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)