[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZDHA0uTelrk1BDb7@corigine.com>
Date: Sat, 8 Apr 2023 21:30:26 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc: m.chetan.kumar@...el.com, linuxwwan@...el.com,
loic.poulain@...aro.org, ryazanov.s.a@...il.com,
johannes@...solutions.net, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
error27@...il.com, kernel-janitors@...r.kernel.org,
vegard.nossum@...cle.com
Subject: Re: [PATCH net] net: wwan: iosm: Fix error handling path in
ipc_pcie_probe()
On Sat, Apr 08, 2023 at 11:12:25PM +0530, Harshit Mogalapalli wrote:
> Hi Simon,
>
> On 08/04/23 9:02 pm, Simon Horman wrote:
> > On Fri, Apr 07, 2023 at 11:56:07PM -0700, Harshit Mogalapalli wrote:
> > > Smatch reports:
> > > drivers/net/wwan/iosm/iosm_ipc_pcie.c:298 ipc_pcie_probe()
> > > warn: missing unwind goto?
> > >
> > > When dma_set_mask fails it directly returns without disabling pci
> > > device and freeing ipc_pcie. Fix this my calling a correct goto label
> > >
> > > As dma_set_mask returns either 0 or -EIO, we can use a goto label, as
> > > it finally returns -EIO.
> > >
> > > Renamed the goto label as name of the label before this patch is not
> > > relevant after this patch.
> >
> > nit: I agree that it's nice to name the labels after what they unwind,
> > rather than where they are called from. But now both schemes
> > are used in this function.
>
> Thanks a lot for the review.
> I agree that the naming of the label is inconsistent, should we do something
> like below?
>
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> index 5bf5a93937c9..04517bd3325a 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> @@ -295,7 +295,7 @@ static int ipc_pcie_probe(struct pci_dev *pci,
> ret = dma_set_mask(ipc_pcie->dev, DMA_BIT_MASK(64));
> if (ret) {
> dev_err(ipc_pcie->dev, "Could not set PCI DMA mask: %d",
> ret);
> - return ret;
> + goto set_mask_fail;
> }
>
> ipc_pcie_config_aspm(ipc_pcie);
> @@ -323,6 +323,7 @@ static int ipc_pcie_probe(struct pci_dev *pci,
> imem_init_fail:
> ipc_pcie_resources_release(ipc_pcie);
> resources_req_fail:
> +set_mask_fail:
> pci_disable_device(pci);
> pci_enable_fail:
> kfree(ipc_pcie);
>
>
>
> -- but resources_req_fail: has nothing in its block particularly.
I think this situation is common when one names the labels
after where they come from. So I'd say this is ok.
An alternative would be to rename all three of labels after what they
unwind.
Powered by blists - more mailing lists