Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2005218imm; Thu, 14 Jun 2018 07:20:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIuPjU3XBFVulGO9FrNCOZ5RtdXGPni9bvPnRrUAD8wauVzNkfPbx13YG/GIG4B0tz80oUV X-Received: by 2002:a65:52c3:: with SMTP id z3-v6mr2528352pgp.69.1528986016873; Thu, 14 Jun 2018 07:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528986016; cv=none; d=google.com; s=arc-20160816; b=yQd+v4bnucweVxXqFFzojlnFLq/wWN3QIu1Cu7HpdKj82cdBmtbaTuhrPbtQzD8z68 8ctKjFrhSCJKwbseXLKxVEa3bVlwjuN8/gQj2OKjQUHnKN7OayAkAKvgJrb6Tp+WtyHX jk8gGSaAYv454o6vD5CK8Zgu8um2+3ac15KkfENYpmRB7PQU9E4X8LuipuhGfa8aSkXr A5llzUfHgMwGmhofWHRDHahnc9BIVCEViE/3Hkn7rY5aQUxx3zueeVH+iDDDf/eWABCX pC7pIMZ2RTBy4KQyN7az9+88adcXtGMioqbKstJ8L9oGt3GEI4lOPCQz84S3EkTdDFpI Oy9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=yDwYUNy8yBSRQ9l9PGxlNQw78W6/ppA2Fm9uAhqmwrw=; b=ZaZ0FhyGi6uSk7W90U7hl4hLmLjePIT6sq9q5Uh2yy6hNmNTQFs+gRq3/8cZcpQ32x MGqS7trxVvMNL3Qs/EhQZI3Y2g9/mSDkrXGrvXKLNIC/ZeoeY0df45jXoBhUHg7TnI4c EkhaweIA2mOlG+ooD7/bk6Nr61leb0rccUkBcXSPoQR0onUSpwbr2Uj9iBNnv2jedyZX qZeQIxvpoNq/m06N/ctbh8pNMD0rbAaf6XbzDr9ZOL2xdb63gYFrQ5cKzPvI+1tkX8nB CNUdnufe2FH9jIfajhw9OFVvDeZmnGwQRgkTf3xgkymCR5lT5XmFCg+5BDosv+gPln7G pNkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Tjvljjh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20-v6si5646729pfl.143.2018.06.14.07.20.02; Thu, 14 Jun 2018 07:20:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Tjvljjh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966199AbeFNONQ (ORCPT + 99 others); Thu, 14 Jun 2018 10:13:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:54666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966150AbeFNONN (ORCPT ); Thu, 14 Jun 2018 10:13:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39FE6208E2; Thu, 14 Jun 2018 14:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528985592; bh=EzjUklIMUnhZdOjLVF51oMpSkQs8WYYit9NHelp2a4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tjvljjh3EeT67y01JA7/fa7KxzKKiXtnFT4KXqVFDL2IY0XqJkSf58b1jFdSdWLzG Y/7ldykYm+sMmHEp4pomYcitq+yIuKB/ZWmhNdZJNbi5iE6wHOAxxyyWA9X4s8GhJf idYMAqL474dJ9I4bvJdmzeektR1AOq/e2ka98ask= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Daniel Rosenberg Subject: [PATCH 4.4 15/24] gpio: No NULL owner Date: Thu, 14 Jun 2018 16:05:10 +0200 Message-Id: <20180614132725.096110374@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614132724.483802160@linuxfoundation.org> References: <20180614132724.483802160@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Walleij commit 7d18f0a14aa6a0d6bad39111c1fb655f07f71d59 upstream. Sometimes a GPIO is fetched with NULL as parent device, and that is just fine. So under these circumstances, avoid using dev_name() to provide a name for the GPIO line. Signed-off-by: Linus Walleij Cc: Daniel Rosenberg Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpiolib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2117,6 +2117,8 @@ struct gpio_desc *__must_check gpiod_get struct gpio_desc *desc = NULL; int status; enum gpio_lookup_flags lookupflags = 0; + /* Maybe we have a device name, maybe not */ + const char *devname = dev ? dev_name(dev) : "?"; dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); @@ -2145,8 +2147,11 @@ struct gpio_desc *__must_check gpiod_get return desc; } - /* If a connection label was passed use that, else use the device name as label */ - status = gpiod_request(desc, con_id ? con_id : dev_name(dev)); + /* + * If a connection label was passed use that, else attempt to use + * the device name as label + */ + status = gpiod_request(desc, con_id ? con_id : devname); if (status < 0) return ERR_PTR(status);