Skip to content

Commit

Permalink
platform/x86: barco-p50-gpio: Add check for platform_driver_register
Browse files Browse the repository at this point in the history
As platform_driver_register() could fail, it should be better
to deal with the return value in order to maintain the code
consisitency.

Fixes: 86af1d0 ("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>
Link: https://lore.kernel.org/r/20220526090345.1444172-1-jiasheng@iscas.ac.cn
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
JiangJias authored and jwrdegoede committed Jun 10, 2022
1 parent 552f3b8 commit 011881b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/platform/x86/barco-p50-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 011881b

Please sign in to comment.