Skip to content

Commit df666e4

Browse files
authored
Merge pull request #2 from Anitha241991/master
Updated pcd_lock.c
2 parents 7147249 + 49bd04a commit df666e4

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

custom_drivers/002pseudo_char_driver/pcd_lock.c

+2-10
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@ ssize_t pcd_read(struct file *filp, char __user *buff, size_t count, loff_t *f_p
8484

8585
/*copy to user */
8686
if(copy_to_user(buff,&device_buffer[*f_pos],count)){
87-
mutex_unlock(&pcd_mutex_lock);
87+
mutex_unlock(&pcd_mutex_lock);
8888
return -EFAULT;
8989
}
90-
91-
else {
92-
9390
/*update the current file postion */
9491
*f_pos += count;
9592

@@ -102,7 +99,6 @@ ssize_t pcd_read(struct file *filp, char __user *buff, size_t count, loff_t *f_p
10299
/*Return number of bytes which have been successfully read */
103100
return count;
104101
}
105-
}
106102

107103
ssize_t pcd_write(struct file *filp, const char __user *buff, size_t count, loff_t *f_pos)
108104
{
@@ -127,12 +123,9 @@ ssize_t pcd_write(struct file *filp, const char __user *buff, size_t count, loff
127123

128124
/*copy from user */
129125
if(copy_from_user(&device_buffer[*f_pos],buff,count)){
130-
mutex_unlock(&pcd_mutex_lock);
126+
mutex_unlock(&pcd_mutex_lock);
131127
return -EFAULT;
132128
}
133-
134-
else {
135-
136129
/*update the current file postion */
137130
*f_pos += count;
138131

@@ -145,7 +138,6 @@ ssize_t pcd_write(struct file *filp, const char __user *buff, size_t count, loff
145138
/*Return number of bytes which have been successfully written */
146139
return count;
147140
}
148-
}
149141

150142
int pcd_open(struct inode *inode, struct file *filp)
151143
{

0 commit comments

Comments
 (0)