udev: Deal with unavailable bus property

Fixes a compiler warning:

../../src/modules/udev-util.c: In function 'pa_udev_get_info':
../../src/modules/udev-util.c:228:443: warning: 'bus' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (!pa_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v)
This commit is contained in:
Arun Raghavan 2015-04-13 08:34:54 +05:30
parent 492fa1ff32
commit 3f0ab4522a

View file

@ -168,7 +168,7 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
struct udev_device *card = NULL; struct udev_device *card = NULL;
char *t; char *t;
const char *v; const char *v;
const char *bus; const char *bus = NULL;
int id; int id;
pa_assert(p); pa_assert(p);
@ -211,7 +211,7 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_NAME)) { if (!pa_proplist_contains(p, PA_PROP_DEVICE_VENDOR_NAME)) {
/* ID_VENDOR_FROM_DATABASE returns the name of IEEE 1394 Phy/Link chipset for FireWire devices */ /* ID_VENDOR_FROM_DATABASE returns the name of IEEE 1394 Phy/Link chipset for FireWire devices */
if (!pa_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")) && *v) if (!pa_safe_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_VENDOR_FROM_DATABASE")) && *v)
pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v); pa_proplist_sets(p, PA_PROP_DEVICE_VENDOR_NAME, v);
else if ((v = udev_device_get_property_value(card, "ID_VENDOR_ENC")) && *v) else if ((v = udev_device_get_property_value(card, "ID_VENDOR_ENC")) && *v)
proplist_sets_unescape(p, PA_PROP_DEVICE_VENDOR_NAME, v); proplist_sets_unescape(p, PA_PROP_DEVICE_VENDOR_NAME, v);
@ -225,7 +225,7 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_NAME)) { if (!pa_proplist_contains(p, PA_PROP_DEVICE_PRODUCT_NAME)) {
/* ID_MODEL_FROM_DATABASE returns the name of IEEE 1394 Phy/Link chipset for FireWire devices */ /* ID_MODEL_FROM_DATABASE returns the name of IEEE 1394 Phy/Link chipset for FireWire devices */
if (!pa_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v) if (!pa_safe_streq(bus, "firewire") && (v = udev_device_get_property_value(card, "ID_MODEL_FROM_DATABASE")) && *v)
pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v); pa_proplist_sets(p, PA_PROP_DEVICE_PRODUCT_NAME, v);
else if ((v = udev_device_get_property_value(card, "ID_MODEL_ENC")) && *v) else if ((v = udev_device_get_property_value(card, "ID_MODEL_ENC")) && *v)
proplist_sets_unescape(p, PA_PROP_DEVICE_PRODUCT_NAME, v); proplist_sets_unescape(p, PA_PROP_DEVICE_PRODUCT_NAME, v);