Skip to content

Commit

Permalink
Merge tag 'extcon-fixes-for-4.1-rc2' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/chanwoo/extcon into char-misc-linus

Chanwoo writes:

Update extcon for v4.1-rc2

This patchset fixes the NULL pointer deference issue of extcon-usb-gpio.c
to prevent the interrupt occur before device initialization.
  • Loading branch information
gregkh committed May 8, 2015
2 parents 5ebe6af + bc1aaba commit 0f5b6ec
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions drivers/extcon/extcon-usb-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ static int usb_extcon_probe(struct platform_device *pdev)
return PTR_ERR(info->id_gpiod);
}

info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable);
if (IS_ERR(info->edev)) {
dev_err(dev, "failed to allocate extcon device\n");
return -ENOMEM;
}

ret = devm_extcon_dev_register(dev, info->edev);
if (ret < 0) {
dev_err(dev, "failed to register extcon device\n");
return ret;
}

ret = gpiod_set_debounce(info->id_gpiod,
USB_GPIO_DEBOUNCE_MS * 1000);
if (ret < 0)
Expand All @@ -142,18 +154,6 @@ static int usb_extcon_probe(struct platform_device *pdev)
return ret;
}

info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable);
if (IS_ERR(info->edev)) {
dev_err(dev, "failed to allocate extcon device\n");
return -ENOMEM;
}

ret = devm_extcon_dev_register(dev, info->edev);
if (ret < 0) {
dev_err(dev, "failed to register extcon device\n");
return ret;
}

platform_set_drvdata(pdev, info);
device_init_wakeup(dev, 1);

Expand Down

0 comments on commit 0f5b6ec

Please sign in to comment.