On Fri, Feb 14, 2020 at 11:37:04PM -0300, Paul Cercueil wrote:
> > I don't like the idea that you change this driver's code just to
> > work around
> > a bug in objtool, and I don't like the idea of working around a
> > future bug
> > that shouldn't be introduced in the first place.
>
> It's not an objtool bug. It's a byproduct of the fact that GCC's
> undefined behavior is inscrutable, and there's no way to determine that
> it actually *wants* to jump to a random function.
>
> And anyway, regardless of objtool, the patch is meant to make the code
> more robust.
>
> Do you not agree that BUG (defined behavior) is more robust than
> unreachable (undefined behavior)?
It's a dead code path. That would be an undefined behaviour, if it was
taken, but it's not.
Given your confidence that humans don't introduce bugs, would you
recommend that we
s/BUG()/unreachable()/
tree-wide?
Another option would be to remove the unreachable() statement, which
would actually improve the generated code by making it more compact (16
bytes of i-cache savings), on top of removing the "fallthrough to next
function" nastiness.
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 96f04d121ebd..13c7d3351ed5 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -2158,7 +2158,8 @@ static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
break;
default:
- unreachable();
+ /* unreachable */
+ break;
}
}