Skip to content

Commit 4b8a826

Browse files
elfringJiri Kosina
authored andcommitted
HID: picoLCD: Deletion of unnecessary checks before three function calls
The functions backlight_device_unregister(), lcd_device_unregister() and rc_unregister_device() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Reviewed-by: Bruno Prémont <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 67db8a8 commit 4b8a826

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

drivers/hid/hid-picolcd_backlight.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ void picolcd_exit_backlight(struct picolcd_data *data)
9494
struct backlight_device *bdev = data->backlight;
9595

9696
data->backlight = NULL;
97-
if (bdev)
98-
backlight_device_unregister(bdev);
97+
backlight_device_unregister(bdev);
9998
}
10099

101100
int picolcd_resume_backlight(struct picolcd_data *data)

drivers/hid/hid-picolcd_cir.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ void picolcd_exit_cir(struct picolcd_data *data)
145145
struct rc_dev *rdev = data->rc_dev;
146146

147147
data->rc_dev = NULL;
148-
if (rdev)
149-
rc_unregister_device(rdev);
148+
rc_unregister_device(rdev);
150149
}
151150

drivers/hid/hid-picolcd_lcd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ void picolcd_exit_lcd(struct picolcd_data *data)
9292
struct lcd_device *ldev = data->lcd;
9393

9494
data->lcd = NULL;
95-
if (ldev)
96-
lcd_device_unregister(ldev);
95+
lcd_device_unregister(ldev);
9796
}
9897

9998
int picolcd_resume_lcd(struct picolcd_data *data)

0 commit comments

Comments
 (0)