juliagoda / CH341SER

CH341SER driver with fixed bug
GNU General Public License v3.0
451 stars 128 forks source link

initialization of ‘unsigned int - Werror=incompatible-pointer-types #39

Open JoseBarreto1 opened 1 year ago

JoseBarreto1 commented 1 year ago

When running the make command, I came across the following errors:

error: initialization of ‘unsigned int ()(struct tty_struct )’ from incompatible pointer type ‘int ()(struct tty_struct )’ [-Werror=incompatible-pointer-types] 1304 | .write_room = ch34x_write_room, | ^~~~ /home/ti/Downloads/CH341SER-master/ch34x.c:1304:20: note: (near initialization for ‘ch34x_device.write_room’) /home/ti/Downloads/CH341SER-master/ch34x.c:1305:21: error: initialization of ‘unsigned int ()(struct tty_struct )’ from incompatible pointer type ‘int ()(struct tty_struct )’ [-Werror=incompatible-pointer-types] 1305 | .chars_in_buffer = ch34x_chars_in_buffer, | ^~~~~ /home/ti/Downloads/CH341SER-master/ch34x.c:1305:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’) cc1: some warnings being treated as errors make[2]: [scripts/Makefile.build:297: /home/ti/Downloads/CH341SER-master/ch34x.o] Erro 1 make[1]: [Makefile:1906: /home/ti/Downloads/CH341SER-master] Erro 2 make[1]: Saindo do diretório '/usr/src/linux-headers-5.15.0-69-generic' make: *** [Makefile:7: default] Erro 2

CyboMer commented 1 year ago

I got a similar error as this. I simply changed the two lines where ch34x_write_room is called from int to unsigned int (lines 942 and 946 for me respectively). This fixed the error. Same thing for the ch34x_chars_in_buffer (lines 968 and 972 for me respectively).

Your lines may be slightly different but the solution should be the same. Hope this helps!