Re: [PATCH] tty: serial: samsung_tty: Check null pointer after calling of_match_node

From: Krzysztof Kozlowski
Date: Tue Jan 11 2022 - 03:24:49 EST


On 11/01/2022 09:16, Jiasheng Jiang wrote:
> If there is no suitable node, of_match_node() will return NULL pointer.

NAK.

This is not possible. All drivers have such pattern and it was
discouraged to add empty/dead NULL checks.

If you think returning NULL is possible, please explain/document it.

> Therefore it should be better to check it in order to avoid the
> dereference of NULL pointer.
> And the only caller s3c24xx_serial_probe() has already checked the
> return value of the s3c24xx_get_driver_data().
> So the new check can be dealed with.
>



Best regards,
Krzysztof