| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Freescale MMA9553L Intelligent Pedometer driver |
|---|
| 3 | 4 | * Copyright (c) 2014, Intel Corporation. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | 5 | */ |
|---|
| 14 | 6 | |
|---|
| 15 | 7 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 1111 | 1103 | if (ret < 0) |
|---|
| 1112 | 1104 | return ret; |
|---|
| 1113 | 1105 | |
|---|
| 1114 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 1115 | 1106 | indio_dev->channels = mma9553_channels; |
|---|
| 1116 | 1107 | indio_dev->num_channels = ARRAY_SIZE(mma9553_channels); |
|---|
| 1117 | 1108 | indio_dev->name = name; |
|---|
| .. | .. |
|---|
| 1143 | 1134 | ret = iio_device_register(indio_dev); |
|---|
| 1144 | 1135 | if (ret < 0) { |
|---|
| 1145 | 1136 | dev_err(&client->dev, "unable to register iio device\n"); |
|---|
| 1146 | | - goto out_poweroff; |
|---|
| 1137 | + goto err_pm_cleanup; |
|---|
| 1147 | 1138 | } |
|---|
| 1148 | 1139 | |
|---|
| 1149 | 1140 | dev_dbg(&indio_dev->dev, "Registered device %s\n", name); |
|---|
| 1150 | 1141 | return 0; |
|---|
| 1151 | 1142 | |
|---|
| 1143 | +err_pm_cleanup: |
|---|
| 1144 | + pm_runtime_dont_use_autosuspend(&client->dev); |
|---|
| 1145 | + pm_runtime_disable(&client->dev); |
|---|
| 1152 | 1146 | out_poweroff: |
|---|
| 1153 | 1147 | mma9551_set_device_state(client, false); |
|---|
| 1154 | 1148 | return ret; |
|---|