Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Feb 1999 23:05:09 +0100 (CET)
From:      Nick Hibma <hibma@skylink.it>
To:        FreeBSD current mailing list <freebsd-current@freebsd.org>
Subject:   const char *
Message-ID:  <Pine.BSF.3.96.990220224447.327A-100000@henny.plazza.it>

next in thread | raw e-mail | index | archive | help

With the new efforts in getting rid of all the warnings in the kernel
compiles I have a problem with the following warning:

../../dev/usb/ukbd.c: In function `ukbd_detach':
../../dev/usb/ukbd.c:373: warning: cast discards `const' from pointer
target type

produced by the following two lines in the USB code:

(dev/usb/ukbd.c)
ukbd_detach(device_t self)
{
...
        const char *devinfo = device_get_desc(self);
...
                free((void *)devinfo, M_USB);


It is a consequence of the following type definition:

(sys/bus_private.h)
struct device {
...
    const char*         desc;   /* driver specific description */
...
}

One problem I have is that a string like that might be produced by
concatenating a few strings together.  In the case of USB the desc is
the string returned by the device. At attach the string is created and
malloc()-ed, at detach free()-ed. 

Anyone savvy enough to tell me what I need to change in the USB code to
get rid of the warning? 

Cheers,

Nick

FreeBSD USB Driver Development
-- 
      e-mail: n_hibma@freebsd.org
   home page: http://www.etla.net/~n_hibma/usb/usb.pl
mailing list: usb-bsd@egroups.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.990220224447.327A-100000>