pn53x_data_new() now returns null ptr upon malloc() error
This commit is contained in:
parent
af57df532b
commit
06d5b54308
8 changed files with 55 additions and 12 deletions
|
|
@ -3122,11 +3122,13 @@ pn53x_current_target_is(const struct nfc_device *pnd, const nfc_target *pnt)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
void *
|
||||
pn53x_data_new(struct nfc_device *pnd, const struct pn53x_io *io)
|
||||
{
|
||||
pnd->chip_data = malloc(sizeof(struct pn53x_data));
|
||||
|
||||
if (!pnd->chip_data) {
|
||||
return NULL;
|
||||
}
|
||||
// Keep I/O functions
|
||||
CHIP_DATA(pnd)->io = io;
|
||||
|
||||
|
|
@ -3165,6 +3167,8 @@ pn53x_data_new(struct nfc_device *pnd, const struct pn53x_io *io)
|
|||
CHIP_DATA(pnd)->supported_modulation_as_initiator = NULL;
|
||||
|
||||
CHIP_DATA(pnd)->supported_modulation_as_target = NULL;
|
||||
|
||||
return pnd->chip_data;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ int pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, cons
|
|||
int pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
|
||||
int pn53x_get_information_about(nfc_device *pnd, char **pbuf);
|
||||
|
||||
void pn53x_data_new(struct nfc_device *pnd, const struct pn53x_io *io);
|
||||
void *pn53x_data_new(struct nfc_device *pnd, const struct pn53x_io *io);
|
||||
void pn53x_data_free(struct nfc_device *pnd);
|
||||
|
||||
#endif // __NFC_CHIPS_PN53X_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue