OSDN Git Service

brcmfmac: of: remove redundant variable len
[uclinux-h8/linux.git] / drivers / net / wireless / broadcom / brcm80211 / brcmfmac / of.c
index 513c7e6..8623bde 100644 (file)
@@ -71,16 +71,18 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
        /* Set board-type to the first string of the machine compatible prop */
        root = of_find_node_by_path("/");
        if (root) {
-               int i, len;
+               int i;
                char *board_type;
                const char *tmp;
 
                of_property_read_string_index(root, "compatible", 0, &tmp);
 
                /* get rid of '/' in the compatible string to be able to find the FW */
-               len = strlen(tmp) + 1;
-               board_type = devm_kzalloc(dev, len, GFP_KERNEL);
-               strscpy(board_type, tmp, len);
+               board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
+               if (!board_type) {
+                       of_node_put(root);
+                       return;
+               }
                for (i = 0; i < board_type[i]; i++) {
                        if (board_type[i] == '/')
                                board_type[i] = '-';