[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241112172812.590665-10-mailhol.vincent@wanadoo.fr>
Date: Wed, 13 Nov 2024 02:27:52 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: netdev@...r.kernel.org,
Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...il.com>,
linux-can@...r.kernel.org,
Marc Kleine-Budde <mkl@...gutronix.de>,
Oliver Hartkopp <socketcan@...tkopp.net>
Cc: Robert Nawrath <mbro1689@...il.com>,
linux-kernel@...r.kernel.org,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH iproute2-next v1 2/6] iplink_can: reduce the visibility of tdc in can_parse_opt()
tdc is only used in a single if block. Move its declaration to the top
of the compound statement where it is used.
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
ip/iplink_can.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 01d977fa..3414d6c3 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -128,7 +128,6 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
{
struct can_bittiming bt = {}, dbt = {};
struct can_ctrlmode cm = { 0 };
- struct rtattr *tdc;
__u32 tdcv = -1, tdco = -1, tdcf = -1;
while (argc > 0) {
@@ -298,7 +297,9 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
if (tdcv != -1 || tdco != -1 || tdcf != -1) {
- tdc = addattr_nest(n, 1024, IFLA_CAN_TDC | NLA_F_NESTED);
+ struct rtattr *tdc = addattr_nest(n, 1024,
+ IFLA_CAN_TDC | NLA_F_NESTED);
+
if (tdcv != -1)
addattr32(n, 1024, IFLA_CAN_TDC_TDCV, tdcv);
if (tdco != -1)
--
2.45.2
Powered by blists - more mailing lists