public inbox for linux-mips@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/clocksource/mips-gic-timer.c:283 looks suspicious: ret != clk
@ 2026-03-04 17:48 Philipp Matthias Hahn
  2026-03-04 18:58 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Matthias Hahn @ 2026-03-04 17:48 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Daniel Lezcano, Thomas Gleixner, linux-mips

Hello,

while looking where IS_ERR(…) plus a manual NULL check can be converted
to IS_ERR_OR_NULL(…) I stumbled by accident over
gic_clocksource_of_init() line 283, where `IS_ERR(clk)` is used combined
with `!ret`:

static int __init gic_clocksource_of_init(struct device_node *node)
{
	struct clk *clk;
	int ret;
	…
	clk = of_clk_get(node, 0);
	if (!IS_ERR(clk)) {
		ret = clk_prepare_enable(clk);
		if (ret < 0) {
			pr_err("Failed to enable clock\n");
			clk_put(clk);
			return ret;
		}
		gic_frequency = clk_get_rate(clk);
	} else {
		…
	}
	ret = gic_clockevent_init();
	if (!ret && !IS_ERR(clk)) {
	     ^^^            ^^^

If this right or should with be changed to
	if (!ret && !IS_ERR(ret)) {
or even better
	if (!IS_ERR_OR_NULL(ret)) {

Philipp Hahn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-04 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 17:48 drivers/clocksource/mips-gic-timer.c:283 looks suspicious: ret != clk Philipp Matthias Hahn
2026-03-04 18:58 ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox