Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 03_read_write/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static ssize_t driver_read(struct file *File, char *user_buffer, size_t count, l
int to_copy, not_copied, delta;

/* Get amount of data to copy */
to_copy = min(count, buffer_pointer);
to_copy = umin(count, buffer_pointer);

/* Copy data to user */
not_copied = copy_to_user(user_buffer, buffer, to_copy);
Expand All @@ -46,7 +46,7 @@ static ssize_t driver_write(struct file *File, const char *user_buffer, size_t c
int to_copy, not_copied, delta;

/* Get amount of data to copy */
to_copy = min(count, sizeof(buffer));
to_copy = umin(count, sizeof(buffer));

/* Copy data to user */
not_copied = copy_from_user(buffer, user_buffer, to_copy);
Expand Down Expand Up @@ -97,7 +97,7 @@ static int __init ModuleInit(void) {
printk("read_write - Device Nr. Major: %d, Minor: %d was registered!\n", my_device_nr >> 20, my_device_nr & 0xfffff);

/* Create device class */
if((my_class = class_create(THIS_MODULE, DRIVER_CLASS)) == NULL) {
if((my_class = class_create(DRIVER_CLASS)) == NULL) {
printk("Device class can not be created!\n");
goto ClassError;
}
Expand Down