Constify ahc_set_name(), ahc_name(). Do not free(9) memory that

may not belong to us.
This commit is contained in:
dyoung 2008-02-11 21:43:46 +00:00
parent a34525837f
commit ab81f0ffe6
3 changed files with 10 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic7xxx.c,v 1.125 2008/01/28 16:08:37 macallan Exp $ */
/* $NetBSD: aic7xxx.c,v 1.126 2008/02/11 21:43:46 dyoung Exp $ */
/*
* Core routines and tables shareable across OS platforms.
@ -39,7 +39,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: aic7xxx.c,v 1.125 2008/01/28 16:08:37 macallan Exp $
* $Id: aic7xxx.c,v 1.126 2008/02/11 21:43:46 dyoung Exp $
*
* //depot/aic7xxx/aic7xxx/aic7xxx.c#112 $
*
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aic7xxx.c,v 1.125 2008/01/28 16:08:37 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: aic7xxx.c,v 1.126 2008/02/11 21:43:46 dyoung Exp $");
#include <dev/ic/aic7xxx_osm.h>
#include <dev/ic/aic7xxx_inline.h>
@ -3900,10 +3900,8 @@ ahc_set_unit(struct ahc_softc *ahc, int unit)
}
void
ahc_set_name(struct ahc_softc *ahc, char *name)
ahc_set_name(struct ahc_softc *ahc, const char *name)
{
if (ahc->name != NULL)
free(ahc->name, M_DEVBUF);
ahc->name = name;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic7xxx_inline.h,v 1.12 2006/11/16 01:32:51 christos Exp $ */
/* $NetBSD: aic7xxx_inline.h,v 1.13 2008/02/11 21:43:46 dyoung Exp $ */
/*
* Inline routines shareable across OS platforms.
@ -226,9 +226,9 @@ ahc_targetcmd_offset(struct ahc_softc *ahc, u_int index)
}
/******************************** Debugging ***********************************/
static __inline char *ahc_name(struct ahc_softc *ahc);
static inline const char *ahc_name(struct ahc_softc *ahc);
static __inline char *
static inline const char *
ahc_name(struct ahc_softc *ahc)
{
return (ahc->name);

View File

@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: aic7xxxvar.h,v 1.54 2008/01/28 16:08:37 macallan Exp $
* $Id: aic7xxxvar.h,v 1.55 2008/02/11 21:43:46 dyoung Exp $
*
* $FreeBSD: /repoman/r/ncvs/src/sys/dev/aic7xxx/aic7xxx.h,v 1.44 2003/01/20 20:44:55 gibbs Exp $
*/
@ -1191,7 +1191,7 @@ struct ahc_softc {
/* Per-Unit descriptive information */
const char *description;
char *name;
const char *name;
int unit;
/* Selection Timer settings */
@ -1280,7 +1280,7 @@ int ahc_resume(struct ahc_softc *);
void ahc_softc_insert(struct ahc_softc *);
struct ahc_softc *ahc_find_softc(struct ahc_softc *);
void ahc_set_unit(struct ahc_softc *, int);
void ahc_set_name(struct ahc_softc *, char *);
void ahc_set_name(struct ahc_softc *, const char *);
int ahc_alloc_scbs(struct ahc_softc *);
void ahc_free(struct ahc_softc *);
int ahc_reset(struct ahc_softc *);