| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * General Purpose I2C multiplexer |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2017 Axentia Technologies AB |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Peter Rosin <peda@axentia.se> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/i2c.h> |
|---|
| .. | .. |
|---|
| 88 | 85 | return -ENOMEM; |
|---|
| 89 | 86 | |
|---|
| 90 | 87 | mux->control = devm_mux_control_get(dev, NULL); |
|---|
| 91 | | - if (IS_ERR(mux->control)) { |
|---|
| 92 | | - if (PTR_ERR(mux->control) != -EPROBE_DEFER) |
|---|
| 93 | | - dev_err(dev, "failed to get control-mux\n"); |
|---|
| 94 | | - return PTR_ERR(mux->control); |
|---|
| 95 | | - } |
|---|
| 88 | + if (IS_ERR(mux->control)) |
|---|
| 89 | + return dev_err_probe(dev, PTR_ERR(mux->control), |
|---|
| 90 | + "failed to get control-mux\n"); |
|---|
| 96 | 91 | |
|---|
| 97 | 92 | parent = mux_parent_adapter(dev); |
|---|
| 98 | | - if (IS_ERR(parent)) { |
|---|
| 99 | | - if (PTR_ERR(parent) != -EPROBE_DEFER) |
|---|
| 100 | | - dev_err(dev, "failed to get i2c-parent adapter\n"); |
|---|
| 101 | | - return PTR_ERR(parent); |
|---|
| 102 | | - } |
|---|
| 93 | + if (IS_ERR(parent)) |
|---|
| 94 | + return dev_err_probe(dev, PTR_ERR(parent), |
|---|
| 95 | + "failed to get i2c-parent adapter\n"); |
|---|
| 103 | 96 | |
|---|
| 104 | 97 | children = of_get_child_count(np); |
|---|
| 105 | 98 | |
|---|
| .. | .. |
|---|
| 120 | 113 | |
|---|
| 121 | 114 | ret = of_property_read_u32(child, "reg", &chan); |
|---|
| 122 | 115 | if (ret < 0) { |
|---|
| 123 | | - dev_err(dev, "no reg property for node '%s'\n", |
|---|
| 124 | | - child->name); |
|---|
| 116 | + dev_err(dev, "no reg property for node '%pOFn'\n", |
|---|
| 117 | + child); |
|---|
| 125 | 118 | goto err_children; |
|---|
| 126 | 119 | } |
|---|
| 127 | 120 | |
|---|
| .. | .. |
|---|
| 141 | 134 | return 0; |
|---|
| 142 | 135 | |
|---|
| 143 | 136 | err_children: |
|---|
| 137 | + of_node_put(child); |
|---|
| 144 | 138 | i2c_mux_del_adapters(muxc); |
|---|
| 145 | 139 | err_parent: |
|---|
| 146 | 140 | i2c_put_adapter(parent); |
|---|