From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Simon Horman <simon.horman@corigine.com>
Cc: m.chetan.kumar@intel.com, linuxwwan@intel.com,
loic.poulain@linaro.org, ryazanov.s.a@gmail.com,
johannes@sipsolutions.net, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
error27@gmail.com, kernel-janitors@vger.kernel.org,
vegard.nossum@oracle.com
Subject: Re: [PATCH net] net: wwan: iosm: Fix error handling path in ipc_pcie_probe()
Date: Sat, 8 Apr 2023 23:12:25 +0530 [thread overview]
Message-ID: <8f47aa3a-9b71-6788-6d75-ccd96dcdb419@oracle.com> (raw)
In-Reply-To: <ZDGJI8Q6lWCJdEMR@corigine.com>
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.
Thanks,
Harshit
>>
>> Fixes: 035e3befc191 ("net: wwan: iosm: fix driver not working with INTEL_IOMMU disabled")
>> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>> ---
>> This is based on static analysis, only compile tested.
>
> I agree with your analysis.
>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
next prev parent reply other threads:[~2023-04-08 17:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-08 6:56 Harshit Mogalapalli
2023-04-08 15:32 ` Simon Horman
2023-04-08 17:42 ` Harshit Mogalapalli [this message]
2023-04-08 19:30 ` Simon Horman
2023-04-08 19:46 ` Harshit Mogalapalli
2023-04-10 8:00 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f47aa3a-9b71-6788-6d75-ccd96dcdb419@oracle.com \
--to=harshit.m.mogalapalli@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=error27@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxwwan@intel.com \
--cc=loic.poulain@linaro.org \
--cc=m.chetan.kumar@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=simon.horman@corigine.com \
--cc=vegard.nossum@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®