linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] PCI/bwctrl: Check for error code from devm_mutex_init() call
@ 2024-10-30 16:31 Andy Shevchenko
  2024-10-30 18:09 ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2024-10-30 16:31 UTC (permalink / raw)
  To: Jonathan Cameron, Bjorn Helgaas, Ilpo Järvinen, linux-pci,
	linux-kernel
  Cc: Andy Shevchenko

Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.

Fixes: 9b3da6e19e4d ("PCI/bwctrl: Add pcie_set_target_speed() to set PCIe Link Speed")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pci/pcie/bwctrl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/bwctrl.c b/drivers/pci/pcie/bwctrl.c
index 3a93ed0550c7..2a19e441a901 100644
--- a/drivers/pci/pcie/bwctrl.c
+++ b/drivers/pci/pcie/bwctrl.c
@@ -299,7 +299,10 @@ static int pcie_bwnotif_probe(struct pcie_device *srv)
 	if (!data)
 		return -ENOMEM;
 
-	devm_mutex_init(&srv->device, &data->set_speed_mutex);
+	ret = devm_mutex_init(&srv->device, &data->set_speed_mutex);
+	if (ret)
+		return ret;
+
 	ret = devm_request_threaded_irq(&srv->device, srv->irq, NULL,
 					pcie_bwnotif_irq_thread,
 					IRQF_SHARED | IRQF_ONESHOT,
-- 
2.43.0.rc1.1336.g36b5255a03ac


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] PCI/bwctrl: Check for error code from devm_mutex_init() call
  2024-10-30 16:31 [PATCH v1 1/1] PCI/bwctrl: Check for error code from devm_mutex_init() call Andy Shevchenko
@ 2024-10-30 18:09 ` Bjorn Helgaas
  2024-10-31  7:01   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2024-10-30 18:09 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, Bjorn Helgaas, Ilpo Järvinen, linux-pci,
	linux-kernel

On Wed, Oct 30, 2024 at 06:31:39PM +0200, Andy Shevchenko wrote:
> Even if it's not critical, the avoidance of checking the error code
> from devm_mutex_init() call today diminishes the point of using devm
> variant of it. Tomorrow it may even leak something. Add the missed
> check.
> 
> Fixes: 9b3da6e19e4d ("PCI/bwctrl: Add pcie_set_target_speed() to set PCIe Link Speed")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Squashed into 399ba413fa23 ("PCI/bwctrl: Add pcie_set_target_speed()
to set PCIe Link Speed"), thanks, Andy.

> ---
>  drivers/pci/pcie/bwctrl.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pcie/bwctrl.c b/drivers/pci/pcie/bwctrl.c
> index 3a93ed0550c7..2a19e441a901 100644
> --- a/drivers/pci/pcie/bwctrl.c
> +++ b/drivers/pci/pcie/bwctrl.c
> @@ -299,7 +299,10 @@ static int pcie_bwnotif_probe(struct pcie_device *srv)
>  	if (!data)
>  		return -ENOMEM;
>  
> -	devm_mutex_init(&srv->device, &data->set_speed_mutex);
> +	ret = devm_mutex_init(&srv->device, &data->set_speed_mutex);
> +	if (ret)
> +		return ret;
> +
>  	ret = devm_request_threaded_irq(&srv->device, srv->irq, NULL,
>  					pcie_bwnotif_irq_thread,
>  					IRQF_SHARED | IRQF_ONESHOT,
> -- 
> 2.43.0.rc1.1336.g36b5255a03ac
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] PCI/bwctrl: Check for error code from devm_mutex_init() call
  2024-10-30 18:09 ` Bjorn Helgaas
@ 2024-10-31  7:01   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-10-31  7:01 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jonathan Cameron, Bjorn Helgaas, Ilpo Järvinen, linux-pci,
	linux-kernel

On Wed, Oct 30, 2024 at 01:09:21PM -0500, Bjorn Helgaas wrote:
> On Wed, Oct 30, 2024 at 06:31:39PM +0200, Andy Shevchenko wrote:
> > Even if it's not critical, the avoidance of checking the error code
> > from devm_mutex_init() call today diminishes the point of using devm
> > variant of it. Tomorrow it may even leak something. Add the missed
> > check.
> > 
> > Fixes: 9b3da6e19e4d ("PCI/bwctrl: Add pcie_set_target_speed() to set PCIe Link Speed")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Squashed into 399ba413fa23 ("PCI/bwctrl: Add pcie_set_target_speed()
> to set PCIe Link Speed"), thanks, Andy.

Thanks, that works for me!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-31  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 16:31 [PATCH v1 1/1] PCI/bwctrl: Check for error code from devm_mutex_init() call Andy Shevchenko
2024-10-30 18:09 ` Bjorn Helgaas
2024-10-31  7:01   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).