1 From af7320ecae0ce646fd2c4a88341a3fbc243553da Mon Sep 17 00:00:00 2001
2 From: Yang Li <yang.lee@linux.alibaba.com>
3 Date: Thu, 11 May 2023 15:08:20 +0800
4 Subject: [PATCH] leds: trigger: netdev: Remove NULL check before dev_{put,
7 The call netdev_{put, hold} of dev_{put, hold} will check NULL,
8 so there is no need to check before using dev_{put, hold},
9 remove it to silence the warnings:
11 ./drivers/leds/trigger/ledtrig-netdev.c:291:3-10: WARNING: NULL check before dev_{put, hold} functions is not needed.
12 ./drivers/leds/trigger/ledtrig-netdev.c:401:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed.
14 Reported-by: Abaci Robot <abaci@linux.alibaba.com>
15 Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=4929
16 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
17 Link: https://lore.kernel.org/r/20230511070820.52731-1-yang.lee@linux.alibaba.com
18 Signed-off-by: Lee Jones <lee@kernel.org>
20 drivers/leds/trigger/ledtrig-netdev.c | 6 ++----
21 1 file changed, 2 insertions(+), 4 deletions(-)
23 --- a/drivers/leds/trigger/ledtrig-netdev.c
24 +++ b/drivers/leds/trigger/ledtrig-netdev.c
25 @@ -462,8 +462,7 @@ static int netdev_trig_notify(struct not
26 get_device_state(trigger_data);
29 - if (trigger_data->net_dev)
30 - dev_put(trigger_data->net_dev);
31 + dev_put(trigger_data->net_dev);
33 trigger_data->net_dev = dev;
35 @@ -594,8 +593,7 @@ static void netdev_trig_deactivate(struc
37 cancel_delayed_work_sync(&trigger_data->work);
39 - if (trigger_data->net_dev)
40 - dev_put(trigger_data->net_dev);
41 + dev_put(trigger_data->net_dev);