From: Dan Carpenter Date: Sat, 26 May 2012 12:14:45 +0000 (+0300) Subject: staging: comedi: cleanup comedi_recognize() X-Git-Tag: Ubuntu-snapdragon-4.4.0-1029.32~12797^2~1022 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1c9de58acc06cba56b5f1bd17a5a74a66427f8b1;p=mirror_ubuntu-zesty-kernel.git staging: comedi: cleanup comedi_recognize() This function is more complicated than it needs to be because of the consts. It's not worth saving them when we drop the consts anyway when we return (void *)name_ptr. Signed-off-by: Dan Carpenter Cc: Ian Abbott Cc: Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 7289dcb5c32c..438c52a313b1 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -304,14 +304,13 @@ static int postconfig(struct comedi_device *dev) * that register their supported board names */ static void *comedi_recognize(struct comedi_driver *driv, const char *name) { - unsigned i; - const char *const *name_ptr = driv->board_name; + char **name_ptr = (char **)driv->board_name; + int i; + for (i = 0; i < driv->num_names; i++) { if (strcmp(*name_ptr, name) == 0) - return (void *)name_ptr; - name_ptr = - (const char *const *)((const char *)name_ptr + - driv->offset); + return name_ptr; + name_ptr = (void *)name_ptr + driv->offset; } return NULL;