Commit ed160b60 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Felix Fietkau

wifi: mt76: Use PTR_ERR_OR_ZERO() to simplify code

Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
simplify code.
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 377844a7
...@@ -58,10 +58,7 @@ int mt7615_thermal_init(struct mt7615_dev *dev) ...@@ -58,10 +58,7 @@ int mt7615_thermal_init(struct mt7615_dev *dev)
wiphy_name(wiphy)); wiphy_name(wiphy));
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, dev, hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, dev,
mt7615_hwmon_groups); mt7615_hwmon_groups);
if (IS_ERR(hwmon)) return PTR_ERR_OR_ZERO(hwmon);
return PTR_ERR(hwmon);
return 0;
} }
EXPORT_SYMBOL_GPL(mt7615_thermal_init); EXPORT_SYMBOL_GPL(mt7615_thermal_init);
......
...@@ -213,10 +213,7 @@ static int mt7915_thermal_init(struct mt7915_phy *phy) ...@@ -213,10 +213,7 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy, hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy,
mt7915_hwmon_groups); mt7915_hwmon_groups);
if (IS_ERR(hwmon)) return PTR_ERR_OR_ZERO(hwmon);
return PTR_ERR(hwmon);
return 0;
} }
static void mt7915_led_set_config(struct led_classdev *led_cdev, static void mt7915_led_set_config(struct led_classdev *led_cdev,
......
...@@ -1219,10 +1219,7 @@ static int mt798x_wmac_init(struct mt7915_dev *dev) ...@@ -1219,10 +1219,7 @@ static int mt798x_wmac_init(struct mt7915_dev *dev)
return PTR_ERR(dev->sku); return PTR_ERR(dev->sku);
dev->rstc = devm_reset_control_get(pdev, "consys"); dev->rstc = devm_reset_control_get(pdev, "consys");
if (IS_ERR(dev->rstc)) return PTR_ERR_OR_ZERO(dev->rstc);
return PTR_ERR(dev->rstc);
return 0;
} }
static int mt798x_wmac_probe(struct platform_device *pdev) static int mt798x_wmac_probe(struct platform_device *pdev)
......
...@@ -55,10 +55,7 @@ static int mt7921_thermal_init(struct mt792x_phy *phy) ...@@ -55,10 +55,7 @@ static int mt7921_thermal_init(struct mt792x_phy *phy)
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy, hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy,
mt7921_hwmon_groups); mt7921_hwmon_groups);
if (IS_ERR(hwmon)) return PTR_ERR_OR_ZERO(hwmon);
return PTR_ERR(hwmon);
return 0;
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment