Skip to content

Commit 7f57416

Browse files
fancerarndb
authored andcommitted
bus: bt1-axi: Optimize the return points in the driver
It's better to have a single return statement where it's applicable instead of returning from a conditional statement if-clause. Let's do this in the request registers, clock and IRQ methods. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Serge Semin <[email protected]> Cc: Alexey Malahov <[email protected]> Cc: Olof Johansson <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: [email protected] Signed-off-by: Arnd Bergmann <[email protected]>
1 parent b7cb430 commit 7f57416

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/bus/bt1-axi.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ static int bt1_axi_request_regs(struct bt1_axi *axi)
124124
}
125125

126126
axi->qos_regs = devm_platform_ioremap_resource_byname(pdev, "qos");
127-
if (IS_ERR(axi->qos_regs)) {
127+
if (IS_ERR(axi->qos_regs))
128128
dev_err(dev, "Couldn't map AXI-bus QoS registers\n");
129-
return PTR_ERR(axi->qos_regs);
130-
}
131129

132-
return 0;
130+
return PTR_ERR_OR_ZERO(axi->qos_regs);
133131
}
134132

135133
static int bt1_axi_request_rst(struct bt1_axi *axi)
@@ -173,12 +171,10 @@ static int bt1_axi_request_clk(struct bt1_axi *axi)
173171
}
174172

175173
ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi);
176-
if (ret) {
174+
if (ret)
177175
dev_err(axi->dev, "Can't add AXI clock disable action\n");
178-
return ret;
179-
}
180176

181-
return 0;
177+
return ret;
182178
}
183179

184180
static int bt1_axi_request_irq(struct bt1_axi *axi)
@@ -192,12 +188,10 @@ static int bt1_axi_request_irq(struct bt1_axi *axi)
192188

193189
ret = devm_request_irq(axi->dev, axi->irq, bt1_axi_isr, IRQF_SHARED,
194190
"bt1-axi", axi);
195-
if (ret) {
191+
if (ret)
196192
dev_err(axi->dev, "Couldn't request AXI EHB IRQ\n");
197-
return ret;
198-
}
199193

200-
return 0;
194+
return ret;
201195
}
202196

203197
static ssize_t count_show(struct device *dev,

0 commit comments

Comments
 (0)