Skip to content

Commit

Permalink
We do not want to free the contents of the udev_device struct, this w…
Browse files Browse the repository at this point in the history
…ill happen anyway when we unref it

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Oct 23, 2013
1 parent 5902842 commit 1fe55a5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/usb_moded-udev.c
Expand Up @@ -180,7 +180,7 @@ void hwal_cleanup(void)

static void udev_parse(struct udev_device *dev)
{
const char *tmp, *tmp2;
const char *tmp;
static int cable = 0, charger = 0; /* track if cable was connected as we cannot distinguish charger and cable disconnects */

/* Check for present first as some drivers use online for when charging is enabled */
Expand All @@ -201,8 +201,8 @@ static void udev_parse(struct udev_device *dev)
{
/* log_debug("UDEV:power supply present\n"); */
/* power supply type might not exist */
tmp2 = udev_device_get_property_value(dev, "POWER_SUPPLY_TYPE");
if(!tmp2)
tmp = udev_device_get_property_value(dev, "POWER_SUPPLY_TYPE");
if(!tmp)
{
/* power supply type might not exist also :( Send connected event but this will not be able
to discriminate between charger/cable */
Expand All @@ -211,20 +211,18 @@ static void udev_parse(struct udev_device *dev)
set_usb_connected(TRUE);
return;
}
if(!strcmp(tmp2, "USB")||!strcmp(tmp2, "USB_CDP"))
if(!strcmp(tmp, "USB")||!strcmp(tmp, "USB_CDP"))
{
log_debug("UDEV:USB cable connected\n");
cable = 1;
set_usb_connected(TRUE);
}
if(!strcmp(tmp2, "USB_DCP"))
if(!strcmp(tmp, "USB_DCP"))
{
log_debug("UDEV:USB dedicated charger connected\n");
charger = 1;
set_charger_connected(TRUE);
}
free((void *) tmp);
free((void *) tmp2);
}
else if(cable)
{
Expand Down

0 comments on commit 1fe55a5

Please sign in to comment.