Check for NULL ptr in HAL_PAL

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Check for NULL ptr in HAL_PAL

Postby faisal » Tue May 22, 2018 8:56 pm

The PAL driver dereferences a pointer to a peripheral address (i.e. GPIOA->ODR). The 'port' pointer should be checked for a NULL pointer using chDbgCheck() (so that it can be disabled for release builds).

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Check for NULL ptr in HAL_PAL

Postby Giovanni » Sun May 27, 2018 11:40 am

Hi,

Where exactly?

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: Check for NULL ptr in HAL_PAL

Postby faisal » Sun May 27, 2018 11:55 am

The dereferencing is done mainly in the hal_pal_lld.h macro. I'm thinking we could do a null ptr check at the hal_pal layer before calling the LLD driver routines/macros.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Check for NULL ptr in HAL_PAL

Postby Giovanni » Sun Jan 06, 2019 4:59 pm

bump

A point, the "port" parameter is not necessarily a pointer, it is dependent on architecture, this should be performed in the various LLDs.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 1 guest