| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Kirkwood thermal sensor driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This software is licensed under the terms of the GNU General Public |
|---|
| 7 | | - * License version 2, as published by the Free Software Foundation, and |
|---|
| 8 | | - * may be copied, distributed, and modified under those terms. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | #include <linux/device.h> |
|---|
| 17 | 8 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 74 | 65 | struct thermal_zone_device *thermal = NULL; |
|---|
| 75 | 66 | struct kirkwood_thermal_priv *priv; |
|---|
| 76 | 67 | struct resource *res; |
|---|
| 68 | + int ret; |
|---|
| 77 | 69 | |
|---|
| 78 | 70 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
|---|
| 79 | 71 | if (!priv) |
|---|
| .. | .. |
|---|
| 91 | 83 | "Failed to register thermal zone device\n"); |
|---|
| 92 | 84 | return PTR_ERR(thermal); |
|---|
| 93 | 85 | } |
|---|
| 86 | + ret = thermal_zone_device_enable(thermal); |
|---|
| 87 | + if (ret) { |
|---|
| 88 | + thermal_zone_device_unregister(thermal); |
|---|
| 89 | + dev_err(&pdev->dev, "Failed to enable thermal zone device\n"); |
|---|
| 90 | + return ret; |
|---|
| 91 | + } |
|---|
| 94 | 92 | |
|---|
| 95 | 93 | platform_set_drvdata(pdev, thermal); |
|---|
| 96 | 94 | |
|---|