Subject: Re: [PATCH v8 2/2] can: esd: add support for esd GmbH PCIe/402 CAN interface family

From: Simon Horman <[email-masked]>
Date: Wed, 8 Nov 2023 10:23:11 -0500

On Tue, Nov 07, 2023 at 01:27:34PM +0000, Stefan Mätje wrote:
> Am Freitag, dem 03.11.2023 um 16:48 +0000 schrieb Simon Horman:
> > On Wed, Oct 25, 2023 at 04:16:35PM +0200, Stefan Mätje wrote:
> > > This patch adds support for the PCI based PCIe/402 CAN interface family
> > > from esd GmbH that is available with various form factors
> > > (https://esd.eu/en/products/402-series-can-interfaces).
> > > 
> > > All boards utilize a FPGA based CAN controller solution developed
> > > by esd (esdACC). For more information on the esdACC see
> > > https://esd.eu/en/products/esdacc.
> > > 
> > > This driver detects all available CAN interface board variants of
> > > the family but atm. operates the CAN-FD capable devices in
> > > Classic-CAN mode only! A later patch will introduce the CAN-FD
> > > functionality in this driver.
> > > 
> > > Co-developed-by: Thomas Körper <[email-masked]>
> > > Signed-off-by: Thomas Körper <[email-masked]>
> > > Signed-off-by: Stefan Mätje <[email-masked]>
> > 
> > ...
> > 
> > > +static int pci402_probe(struct pci_dev *pdev, const struct pci_device_id
> > > *ent)
> > > +{
> > > +       struct pci402_card *card = NULL;
> > > +       int err;
> > > +
> > > +       err = pci_enable_device(pdev);
> > > +       if (err)
> > > +               return err;
> > > +
> > > +       card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL);
> > > +       if (!card)
> > 
> > Hi Thomas and Stefan,
> > 
> > If this condition is met then the function will return err,
> > but err is set to 0. Perhaps it should be set to an error value here?
> > 
> > Flagged by Smatch.
> 
> Hi Simon,
> 
> thank you for reviewing this. Looking at the code it is apparently wrong.
> 
> I was not aware of smatch. I got a copy and could reproduce the error report.
> This will add another tool of static code analysis to my release routine.
> 
> An upgraded patch with a fix will follow.

Thanks Stefan, that sounds good to me on both counts.

...