[bug report] phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY

Dan Carpenter dan.carpenter at linaro.org
Mon Jul 31 04:40:20 PDT 2023


On Mon, Jul 31, 2023 at 10:44:41AM +0000, Stanley Chang[昌育德] wrote:
> >     896         } else {
> >     897                 unsigned char *buf;
> >     898                 size_t buf_size;
> >     899
> >     900                 buf = nvmem_cell_read(cell, &buf_size);
> > 
> > nvmem_cell_read() can fail.
> > 
> > Sometimes, it's okay ot ignore errors, like if your reads from PCI start failing,
> > then there is nothing we can do as a kernel.  The user needs to buy new
> > hardware.  We need the serenity to ignore the things we cannot fix.
> > 
> > But here the allocation can fail.  So that needs to be checked and handled
> > correctly.
> > 
> > --> 901                 value = buf[0] & phy_cfg->dc_driving_mask;
> >                                 ^^^^^^
> > warning
> > 
> >     902
> >     903                 kfree(buf);
> >     904                 nvmem_cell_put(cell);
> >     905         }
> >     906
> > 
> 
> I will fix this error.
> 
> I ran by
> 1. make -j32 CHECK="/home/tools/smatch/smatch/smatch" C=1
> 2. ~/path/to/smatch/smatch_scripts/kchecker --spammy drivers/modified_file.c
> Refer to https://blogs.oracle.com/linux/post/smatch-static-analysis-tool-overview-by-dan-carpenter
> 
> But I can't get this error.
> 
> Please help provide the check method.

You need to have the cross function database for this.  The normal
way would be to run smatch_scripts/build_kernel_data.sh but it takes
hours and hours to run.

You could just load the information from drivers/nvmem/core.c if you
want:

~/path/to/smatch/smatch_scripts/kchecker --info drivers/nvmem/core.c | tee out
~/path/to/smatch/smatch_data/db/create_db.sh out
~/path/to/smatch/smatch_scripts/kchecker drivers/phy/realtek/phy-rtk-usb2.c

regards,
dan carpenter




More information about the linux-phy mailing list