Don't need to copy the structure again, because cdev_register doesn't affect it. Made that clear by adding "const" in cdev_register's declaration.

This commit is contained in:
Vincent Barrilliot 2023-02-01 21:56:54 +01:00
parent 4d2568c5db
commit d4bc2dc1f5
2 changed files with 3 additions and 3 deletions

View file

@ -46,7 +46,7 @@ void cdev_init_system() {
//
// Register a channel device driver
//
short cdev_register(p_dev_chan device) {
short cdev_register(const p_dev_chan device) {
TRACE1("cdev_register %s", device->name);
short dev;
@ -70,7 +70,7 @@ short cdev_register(p_dev_chan device) {
cdev->seek = device->seek;
cdev->flush = device->flush;
cdev->ioctrl = device->ioctrl;
return 0;
return E_OK;
} else {
return DEV_ERR_BADDEV;
}

View file

@ -89,7 +89,7 @@ extern void cdev_init_system();
* Inputs:
* p_dev_chan = pointer to the description of the channel device
*/
extern short cdev_register(p_dev_chan device);
extern short cdev_register(const p_dev_chan device);
/*
* Get a free channel