[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <06e868cb-f96e-46af-9484-a613de0baaaf@kadam.mountain>
Date: Thu, 26 Oct 2023 12:04:00 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Su Hui <suhui@...china.com>
Cc: lukas@...ner.de, maarten.lankhorst@...ux.intel.com,
mripard@...nel.org, tzimmermann@...e.de, airlied@...il.com,
daniel@...ll.ch, tiwai@...e.de, Jim.Qu@....com,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] vga_switcheroo: Fix impossible judgment condition
On Thu, Oct 26, 2023 at 04:46:29PM +0800, Su Hui wrote:
> On 2023/10/26 12:44, Dan Carpenter wrote:
> > On Thu, Oct 26, 2023 at 10:10:57AM +0800, Su Hui wrote:
> > > 'id' is enum type like unsigned int, so it will never be less than zero.
> > >
> > > Fixes: 4aaf448fa975 ("vga_switcheroo: set audio client id according to bound GPU id")
> > > Signed-off-by: Su Hui <suhui@...china.com>
> > > ---
> > > drivers/gpu/vga/vga_switcheroo.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> > > index 365e6ddbe90f..d3064466fd3a 100644
> > > --- a/drivers/gpu/vga/vga_switcheroo.c
> > > +++ b/drivers/gpu/vga/vga_switcheroo.c
> > > @@ -375,7 +375,7 @@ int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
> > > mutex_lock(&vgasr_mutex);
> > > if (vgasr_priv.active) {
> > > id = vgasr_priv.handler->get_client_id(vga_dev);
> > > - if (id < 0) {
> > > + if ((int)id < 0) {
> > Hi,
> >
> > I feel like you're using Smatch? Which is great! Fantastic!
> Yep, Smatch helps meĀ a lot to find these bugs! I really like this excellent
> tool!
> >
> > Have you built the cross function database? If you have there is a
> > command that's useful.
> Not yet, bu I want to build this.
Yeah. It's super useful for kernel development. It helps to understand
how functions are called and where variables are set etc. The smatch
documentation is crap, I know. But I did write a short blog about the
cross function DB.
https://staticthinking.wordpress.com/2023/05/02/the-cross-function-db/
It's simple to build, but it takes a long time. Just run
smatch_scripts/build_kernel_data.sh
regards,
dan carpenter
Powered by blists - more mailing lists