Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character device driver implementation is finish #125

Open
wants to merge 9 commits into
base: Oleksandr.Shmatko
Choose a base branch
from
Open

Character device driver implementation is finish #125

wants to merge 9 commits into from

Conversation

shmatko1095
Copy link

Character device driver implementation is finish

Please review

Empty shell script file is created

Signed-off-by: Oleksandr Shmatko <[email protected]>
…tion

Add commnd for /realise branch create
Add command for copy .c files to /tmp/guesanumber
Add functions for archivating .c files from /tmp/guesanumber to release/guesanumber.tar.gz

Signed-off-by: Oleksandr Shmatko <[email protected]>
"tmp/guesanumber" defined as $tmpDir variable;
"realise" defined as $realiseDir variable;
add chiking of existing $tmpDir variable;
add remooving $tmpDir at scritp finish

Signed-off-by: Oleksandr Shmatko <[email protected]>
Empty line is added to the end of script

Signed-off-by: Oleksandr Shmatko <[email protected]>
@shmatko1095 shmatko1095 changed the title Oleksandr.shmatko Character device driver implementation is finish Apr 17, 2019
@shmatko1095 shmatko1095 added the ready The PR is ready for review label Apr 17, 2019
Copy link

@oleg-h2o oleg-h2o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's almost perfect.

}
printk(KERN_INFO "chrdev: Device initialized succesfully\n");

buffer_create();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions buffer_crerate() and create_proc() can return errors, but these errors are ignored here.

@oleg-h2o oleg-h2o added changes requested The PR review revealed issues which should be fixed (set by reviewer). good first issue Good for newcomers and removed ready The PR is ready for review labels Apr 17, 2019
Added error handring of buffer_create() and create_proc() in chrdev_init() function;

Signed-off-by: Oleksandr Shmtko <[email protected]>
@shmatko1095 shmatko1095 added ready The PR is ready for review and removed changes requested The PR review revealed issues which should be fixed (set by reviewer). good first issue Good for newcomers labels Apr 17, 2019
}
printk(KERN_INFO "chrdev: Device initialized succesfully\n");

if (0 == err) err = buffer_create();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If buffer_create() (or create_proc()) fails here, you should immediately return with error code...

Copy link

@galkinletter galkinletter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need fix

module_init(chrdev_init);
module_exit(chrdev_exit);

MODULE_LICENSE("GPL");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("");
MODULE_DESCRIPTION("");
MODULE_VERSION("0.1");

Please fix description. Add AUTHOR, version

#endif

#define BUFFER_SIZE 1024
#define DEVICE_NAME "charDevice"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define DEVICE_NAME "charDevice"
#define DEVICE_NAME "charDevice"
#define CLASS_NAME "charClass"

Please use kernel code style https://www.kernel.org/doc/html/v4.10/process/coding-style.html

Please use Check kernel code with checkpatch

clean:
$(MAKE) -C $(KERNELDIR) M=$(CURDIR) clean

endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
endif
endif

Please fix end of line

@galkinletter galkinletter added changes requested The PR review revealed issues which should be fixed (set by reviewer). and removed ready The PR is ready for review labels Apr 23, 2019
DEVICE_NAME, CLASS_NAME changed according to linux-codestyle;
chrdev_init(void) immediately returns an error if it is.

Signed-off-by: Oleksandr Shmtko <[email protected]>
@shmatko1095 shmatko1095 added ready The PR is ready for review and removed changes requested The PR review revealed issues which should be fixed (set by reviewer). labels Apr 24, 2019
Copy link

@oleg-h2o oleg-h2o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should free resources carefully.


err = create_proc();
if (IS_ERR(err)) {
class_destroy(pclass);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory have allocated here. Do free it on error handling.


err = buffer_create();
if (IS_ERR(err)) {
class_destroy(pclass);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device_destroy()?

@galkinletter galkinletter added changes requested The PR review revealed issues which should be fixed (set by reviewer). and removed ready The PR is ready for review labels May 7, 2019
Copy link

@galkinletter galkinletter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need fix error handling and device_destroy()

@galkinletter galkinletter added ready The PR is ready for review changes requested The PR review revealed issues which should be fixed (set by reviewer). and removed changes requested The PR review revealed issues which should be fixed (set by reviewer). ready The PR is ready for review labels May 31, 2019
@galkinletter
Copy link

Please fix ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes requested The PR review revealed issues which should be fixed (set by reviewer).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants