Re: [PATCH v3 1/2] staging: dgap: tty.c: adds error handing in tty driver allocations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 1, 2013 at 1:59 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> On Tue, Oct 01, 2013 at 12:32:06PM -0400, Lidza Louina wrote:
>> On Tue, Oct 1, 2013 at 12:09 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>> > On Tue, Oct 01, 2013 at 12:00:23PM -0400, Lidza Louina wrote:
>> >> @@ -306,7 +316,16 @@ int dgap_tty_register(struct board_t *brd)
>> >>
>> >>       DPR_INIT(("DGAP REGISTER TTY: MAJORS: %d %d\n", brd->SerialDriver->major,
>> >>               brd->PrintDriver->major));
>> >> -
>> >
>> > You need a "return 0;" here otherwise we release everything on success
>> > when we worked so hard to allocate it.
>> >
>> > regards,
>> > dan carpenter
>>
>> When I add that I get these smatch warnings:
>>
>> drivers/staging/dgap/dgap_tty.c:323 dgap_tty_register() info: ignoring
>> unreachable code.
>> drivers/staging/dgap/dgap_tty.c:323 dgap_tty_register() info: ignoring
>> unreachable code.
>>
>> Ignore these warnings?
>
> No.  The warnings are correct and show a bug.  The last two errors
> aren't handled correctly.  Also I see I left out an if statement
> from my previous instructions...

Alrighty. I'm going to learn to differentiate between false smatch
warnings and real ones. >_<

> You know what?  This function is never called, let's just delete it
> instead of messing about.

This function isn't called because there isn't a
dgap_tty_unregister(). The both of them would be called in the
dgap_found_board() in dgap_driver.c. dgap_tty_register() is where the
driver is where the driver is allocates space and registered. It needs
it. I want to make sure it's right, before I create a
dgap_tty_unregister().

Lidza
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux