Hi Dan,
Thanks for your report.
I check the code again, and find that returning zero should indicate an
error here.
Good catch of Smatch :)
Sorry for my mistake in my patch...
Please revert the incorrect change caused by my patch b9302fa7ed97.
CC to Mauro Carvalho Chehab and Hans Verkuil.
Best wishes,
Jia-Ju Bai
On 2021/5/12 22:16, Dan Carpenter wrote:
On Wed, May 12, 2021 at 05:03:26PM +0300, Dan Carpenter wrote:
Hello Jia-Ju Bai,
The patch b9302fa7ed97: "media: tuners: fix error return code of
hybrid_tuner_request_state()" from Mar 6, 2021, leads to the
following static checker warnings:
drivers/media/tuners/tuner-simple.c:1112 simple_tuner_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/mxl5007t.c:885 mxl5007t_attach() error: potential null dereference 'state'. (<unknown> returns null)
drivers/media/tuners/tda18271-fe.c:1311 tda18271_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/xc4000.c:1685 xc4000_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/xc4000.c:1699 xc4000_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/xc5000.c:1397 xc5000_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/r820t.c:2350 r820t_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/tuner-xc2028.c:1500 xc2028_attach() error: potential null dereference 'priv'. (<unknown> returns null)
drivers/media/tuners/tuner-i2c.h
109 /* The return value of hybrid_tuner_request_state indicates the number of
110 * instances using this tuner object.
111 *
112 * 0 - no instances, indicates an error - kzalloc must have failed
The comment says that hybrid_tuner_request_state() returns an error.
I meant returns zero on error.