All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: barco-p50-gpio: Add check for platform_driver_register
@ 2022-05-26  9:03 Jiasheng Jiang
  2022-05-30 21:20 ` Peter Korsgaard
  2022-06-10 18:48 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2022-05-26  9:03 UTC (permalink / raw)
  To: santoshkumar.yadav, peter.korsgaard, hdegoede, markgross
  Cc: platform-driver-x86, linux-kernel, Jiasheng Jiang

As platform_driver_register() could fail, it should be better
to deal with the return value in order to maintain the code
consisitency.

Fixes: 86af1d02d458 ("platform/x86: Support for EC-connected GPIOs for identify LED/button on Barco P50 board")

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/platform/x86/barco-p50-gpio.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/barco-p50-gpio.c b/drivers/platform/x86/barco-p50-gpio.c
index 05534287bc26..8dd672339485 100644
--- a/drivers/platform/x86/barco-p50-gpio.c
+++ b/drivers/platform/x86/barco-p50-gpio.c
@@ -405,11 +405,14 @@ MODULE_DEVICE_TABLE(dmi, dmi_ids);
 static int __init p50_module_init(void)
 {
 	struct resource res = DEFINE_RES_IO(P50_GPIO_IO_PORT_BASE, P50_PORT_CMD + 1);
+	int ret;
 
 	if (!dmi_first_match(dmi_ids))
 		return -ENODEV;
 
-	platform_driver_register(&p50_gpio_driver);
+	ret = platform_driver_register(&p50_gpio_driver);
+	if (ret)
+		return ret;
 
 	gpio_pdev = platform_device_register_simple(DRIVER_NAME, PLATFORM_DEVID_NONE, &res, 1);
 	if (IS_ERR(gpio_pdev)) {
-- 
2.25.1


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

* Re: [PATCH] platform/x86: barco-p50-gpio: Add check for platform_driver_register
  2022-05-26  9:03 [PATCH] platform/x86: barco-p50-gpio: Add check for platform_driver_register Jiasheng Jiang
@ 2022-05-30 21:20 ` Peter Korsgaard
  2022-06-10 18:48 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-05-30 21:20 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: santoshkumar.yadav, peter.korsgaard, hdegoede, markgross,
	platform-driver-x86, linux-kernel

>>>>> "Jiasheng" == Jiasheng Jiang <jiasheng@iscas.ac.cn> writes:

 > As platform_driver_register() could fail, it should be better
 > to deal with the return value in order to maintain the code
 > consisitency.

 > Fixes: 86af1d02d458 ("platform/x86: Support for EC-connected GPIOs for
 > identify LED/button on Barco P50 board")

 > Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Acked-by: Peter Korsgaard <peter.korsgaard@barco.com>


> ---
 >  drivers/platform/x86/barco-p50-gpio.c | 5 ++++-
 >  1 file changed, 4 insertions(+), 1 deletion(-)

 > diff --git a/drivers/platform/x86/barco-p50-gpio.c b/drivers/platform/x86/barco-p50-gpio.c
 > index 05534287bc26..8dd672339485 100644
 > --- a/drivers/platform/x86/barco-p50-gpio.c
 > +++ b/drivers/platform/x86/barco-p50-gpio.c
 > @@ -405,11 +405,14 @@ MODULE_DEVICE_TABLE(dmi, dmi_ids);
 >  static int __init p50_module_init(void)
 >  {
 >  	struct resource res = DEFINE_RES_IO(P50_GPIO_IO_PORT_BASE, P50_PORT_CMD + 1);
 > +	int ret;
 
 >  	if (!dmi_first_match(dmi_ids))
 >  		return -ENODEV;
 
 > -	platform_driver_register(&p50_gpio_driver);
 > +	ret = platform_driver_register(&p50_gpio_driver);
 > +	if (ret)
 > +		return ret;
 
 >  	gpio_pdev = platform_device_register_simple(DRIVER_NAME, PLATFORM_DEVID_NONE, &res, 1);
 >  	if (IS_ERR(gpio_pdev)) {
 > -- 

 > 2.25.1


-- 
Bye, Peter Korsgaard

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

* Re: [PATCH] platform/x86: barco-p50-gpio: Add check for platform_driver_register
  2022-05-26  9:03 [PATCH] platform/x86: barco-p50-gpio: Add check for platform_driver_register Jiasheng Jiang
  2022-05-30 21:20 ` Peter Korsgaard
@ 2022-06-10 18:48 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-06-10 18:48 UTC (permalink / raw)
  To: Jiasheng Jiang, santoshkumar.yadav, peter.korsgaard, markgross
  Cc: platform-driver-x86, linux-kernel

Hi,

On 5/26/22 11:03, Jiasheng Jiang wrote:
> As platform_driver_register() could fail, it should be better
> to deal with the return value in order to maintain the code
> consisitency.
> 
> Fixes: 86af1d02d458 ("platform/x86: Support for EC-connected GPIOs for identify LED/button on Barco P50 board")
> 
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/barco-p50-gpio.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/barco-p50-gpio.c b/drivers/platform/x86/barco-p50-gpio.c
> index 05534287bc26..8dd672339485 100644
> --- a/drivers/platform/x86/barco-p50-gpio.c
> +++ b/drivers/platform/x86/barco-p50-gpio.c
> @@ -405,11 +405,14 @@ MODULE_DEVICE_TABLE(dmi, dmi_ids);
>  static int __init p50_module_init(void)
>  {
>  	struct resource res = DEFINE_RES_IO(P50_GPIO_IO_PORT_BASE, P50_PORT_CMD + 1);
> +	int ret;
>  
>  	if (!dmi_first_match(dmi_ids))
>  		return -ENODEV;
>  
> -	platform_driver_register(&p50_gpio_driver);
> +	ret = platform_driver_register(&p50_gpio_driver);
> +	if (ret)
> +		return ret;
>  
>  	gpio_pdev = platform_device_register_simple(DRIVER_NAME, PLATFORM_DEVID_NONE, &res, 1);
>  	if (IS_ERR(gpio_pdev)) {


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

end of thread, other threads:[~2022-06-10 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26  9:03 [PATCH] platform/x86: barco-p50-gpio: Add check for platform_driver_register Jiasheng Jiang
2022-05-30 21:20 ` Peter Korsgaard
2022-06-10 18:48 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.