Loading drivers/char/diag/diag_memorydevice.c +46 −5 Original line number Diff line number Diff line /* Copyright (c) 2014-2015, 2016, 2018 The Linux Foundation. /* Copyright (c) 2014-2016, 2018 The Linux Foundation. * All rights reserved. * * This program is free software; you can redistribute it and/or modify Loading Loading @@ -345,12 +345,12 @@ int diag_md_close_peripheral(int id, uint8_t peripheral) return 0; } int diag_md_init() int diag_md_init(void) { int i, j; struct diag_md_info *ch = NULL; for (i = 0; i < NUM_DIAG_MD_DEV; i++) { for (i = 0; i < DIAG_MD_LOCAL_LAST; i++) { ch = &diag_md[i]; ch->num_tbl_entries = diag_mempools[ch->mempool].poolsize; ch->tbl = kzalloc(ch->num_tbl_entries * Loading @@ -374,12 +374,53 @@ fail: return -ENOMEM; } void diag_md_exit() int diag_md_mdm_init(void) { int i, j; struct diag_md_info *ch = NULL; for (i = DIAG_MD_BRIDGE_BASE; i < NUM_DIAG_MD_DEV; i++) { ch = &diag_md[i]; ch->num_tbl_entries = diag_mempools[ch->mempool].poolsize; ch->tbl = kcalloc(ch->num_tbl_entries, sizeof(*ch->tbl), GFP_KERNEL); if (!ch->tbl) goto fail; for (j = 0; j < ch->num_tbl_entries; j++) { ch->tbl[j].buf = NULL; ch->tbl[j].len = 0; ch->tbl[j].ctx = 0; } spin_lock_init(&(ch->lock)); } return 0; fail: diag_md_mdm_exit(); return -ENOMEM; } void diag_md_exit(void) { int i; struct diag_md_info *ch = NULL; for (i = 0; i < NUM_DIAG_MD_DEV; i++) { for (i = 0; i < DIAG_MD_LOCAL_LAST; i++) { ch = &diag_md[i]; kfree(ch->tbl); ch->num_tbl_entries = 0; ch->ops = NULL; } } void diag_md_mdm_exit(void) { int i; struct diag_md_info *ch = NULL; for (i = DIAG_MD_BRIDGE_BASE; i < NUM_DIAG_MD_DEV; i++) { ch = &diag_md[i]; kfree(ch->tbl); ch->num_tbl_entries = 0; Loading drivers/char/diag/diag_memorydevice.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2015, 2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -46,7 +46,9 @@ struct diag_md_info { extern struct diag_md_info diag_md[NUM_DIAG_MD_DEV]; int diag_md_init(void); int diag_md_mdm_init(void); void diag_md_exit(void); void diag_md_mdm_exit(void); void diag_md_open_all(void); void diag_md_close_all(void); int diag_md_register(int id, int ctx, struct diag_mux_ops *ops); Loading drivers/char/diag/diagchar_core.c +1 −0 Original line number Diff line number Diff line Loading @@ -951,6 +951,7 @@ static int diag_remote_init(void) poolsize_mdm_dci_write); diagmem_setsize(POOL_TYPE_QSC_MUX, itemsize_qsc_usb, poolsize_qsc_usb); diag_md_mdm_init(); driver->hdlc_encode_buf = kzalloc(DIAG_MAX_HDLC_BUF_SIZE, GFP_KERNEL); if (!driver->hdlc_encode_buf) return -ENOMEM; Loading Loading
drivers/char/diag/diag_memorydevice.c +46 −5 Original line number Diff line number Diff line /* Copyright (c) 2014-2015, 2016, 2018 The Linux Foundation. /* Copyright (c) 2014-2016, 2018 The Linux Foundation. * All rights reserved. * * This program is free software; you can redistribute it and/or modify Loading Loading @@ -345,12 +345,12 @@ int diag_md_close_peripheral(int id, uint8_t peripheral) return 0; } int diag_md_init() int diag_md_init(void) { int i, j; struct diag_md_info *ch = NULL; for (i = 0; i < NUM_DIAG_MD_DEV; i++) { for (i = 0; i < DIAG_MD_LOCAL_LAST; i++) { ch = &diag_md[i]; ch->num_tbl_entries = diag_mempools[ch->mempool].poolsize; ch->tbl = kzalloc(ch->num_tbl_entries * Loading @@ -374,12 +374,53 @@ fail: return -ENOMEM; } void diag_md_exit() int diag_md_mdm_init(void) { int i, j; struct diag_md_info *ch = NULL; for (i = DIAG_MD_BRIDGE_BASE; i < NUM_DIAG_MD_DEV; i++) { ch = &diag_md[i]; ch->num_tbl_entries = diag_mempools[ch->mempool].poolsize; ch->tbl = kcalloc(ch->num_tbl_entries, sizeof(*ch->tbl), GFP_KERNEL); if (!ch->tbl) goto fail; for (j = 0; j < ch->num_tbl_entries; j++) { ch->tbl[j].buf = NULL; ch->tbl[j].len = 0; ch->tbl[j].ctx = 0; } spin_lock_init(&(ch->lock)); } return 0; fail: diag_md_mdm_exit(); return -ENOMEM; } void diag_md_exit(void) { int i; struct diag_md_info *ch = NULL; for (i = 0; i < NUM_DIAG_MD_DEV; i++) { for (i = 0; i < DIAG_MD_LOCAL_LAST; i++) { ch = &diag_md[i]; kfree(ch->tbl); ch->num_tbl_entries = 0; ch->ops = NULL; } } void diag_md_mdm_exit(void) { int i; struct diag_md_info *ch = NULL; for (i = DIAG_MD_BRIDGE_BASE; i < NUM_DIAG_MD_DEV; i++) { ch = &diag_md[i]; kfree(ch->tbl); ch->num_tbl_entries = 0; Loading
drivers/char/diag/diag_memorydevice.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2015, 2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -46,7 +46,9 @@ struct diag_md_info { extern struct diag_md_info diag_md[NUM_DIAG_MD_DEV]; int diag_md_init(void); int diag_md_mdm_init(void); void diag_md_exit(void); void diag_md_mdm_exit(void); void diag_md_open_all(void); void diag_md_close_all(void); int diag_md_register(int id, int ctx, struct diag_mux_ops *ops); Loading
drivers/char/diag/diagchar_core.c +1 −0 Original line number Diff line number Diff line Loading @@ -951,6 +951,7 @@ static int diag_remote_init(void) poolsize_mdm_dci_write); diagmem_setsize(POOL_TYPE_QSC_MUX, itemsize_qsc_usb, poolsize_qsc_usb); diag_md_mdm_init(); driver->hdlc_encode_buf = kzalloc(DIAG_MAX_HDLC_BUF_SIZE, GFP_KERNEL); if (!driver->hdlc_encode_buf) return -ENOMEM; Loading