Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: line6: eliminate useless NULL checks

The line6 driver checks struct field addresses for NULL where it does
not make sense to do so. The struct has already been checked for NULL
and there is no value in checking the first field's address too.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Stefan Hajnoczi and committed by
Greg Kroah-Hartman
188e6645 153e3876

+4 -20
+1 -5
drivers/staging/line6/pod.c
··· 1149 1149 static void pod_destruct(struct usb_interface *interface) 1150 1150 { 1151 1151 struct usb_line6_pod *pod = usb_get_intfdata(interface); 1152 - struct usb_line6 *line6; 1153 1152 1154 1153 if (pod == NULL) 1155 1154 return; 1156 - line6 = &pod->line6; 1157 - if (line6 == NULL) 1158 - return; 1159 - line6_cleanup_audio(line6); 1155 + line6_cleanup_audio(&pod->line6); 1160 1156 1161 1157 del_timer(&pod->startup_timer); 1162 1158 cancel_work_sync(&pod->startup_work);
+1 -5
drivers/staging/line6/podhd.c
··· 80 80 static void podhd_destruct(struct usb_interface *interface) 81 81 { 82 82 struct usb_line6_podhd *podhd = usb_get_intfdata(interface); 83 - struct usb_line6 *line6; 84 83 85 84 if (podhd == NULL) 86 85 return; 87 - line6 = &podhd->line6; 88 - if (line6 == NULL) 89 - return; 90 - line6_cleanup_audio(line6); 86 + line6_cleanup_audio(&podhd->line6); 91 87 } 92 88 93 89 /*
+1 -5
drivers/staging/line6/toneport.c
··· 295 295 static void toneport_destruct(struct usb_interface *interface) 296 296 { 297 297 struct usb_line6_toneport *toneport = usb_get_intfdata(interface); 298 - struct usb_line6 *line6; 299 298 300 299 if (toneport == NULL) 301 300 return; 302 - line6 = &toneport->line6; 303 - if (line6 == NULL) 304 - return; 305 - line6_cleanup_audio(line6); 301 + line6_cleanup_audio(&toneport->line6); 306 302 } 307 303 308 304 /*
+1 -5
drivers/staging/line6/variax.c
··· 572 572 static void variax_destruct(struct usb_interface *interface) 573 573 { 574 574 struct usb_line6_variax *variax = usb_get_intfdata(interface); 575 - struct usb_line6 *line6; 576 575 577 576 if (variax == NULL) 578 577 return; 579 - line6 = &variax->line6; 580 - if (line6 == NULL) 581 - return; 582 - line6_cleanup_audio(line6); 578 + line6_cleanup_audio(&variax->line6); 583 579 584 580 del_timer(&variax->startup_timer1); 585 581 del_timer(&variax->startup_timer2);