Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp762478imm; Wed, 17 Oct 2018 07:59:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV60F1lCRtT7H9BeaEv/Ko8p7VVSO8rjxgdnJsJP6oMyNDN0gktGDsNU8gWV2H72M9ao8tC24 X-Received: by 2002:a17:902:507:: with SMTP id 7-v6mr17221009plf.272.1539788352918; Wed, 17 Oct 2018 07:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539788352; cv=none; d=google.com; s=arc-20160816; b=APSHfndgaRbuyHTBdYX2tisLWTh9vLzzfDPvALO6pqCx4526U0NHgrWY5q0TsRxI4W hp85t7ArkixEX60tP39jwnVm+fAQzLixuuT31ZYsXVYS9dZFVxxrNaL+GT686IsIDE4H ZgQJRNkE7iHqbsLGMMYZvLs2GBcizqIBa2h3/J6MNF06Sunna6TqBQA/XSM8dYiu5eM3 IvId0UkqOUt+DArxBFX7AlzHHrej8p0hcWjffOakhLcbXFxWVm0uNh7mGRAidVpTiVH8 JVlecpA8EA4NO9PL2viyiqipUeIPBT3Ghg1ldzP1tUWkOVDsa86KigF7mi8sd1tCByjw G+tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MdiAtzhZ1B2Yf0Zq0AObTI7jcD1hwPM0Z0G5zt2LZFQ=; b=CT5MCrE6SoUTwW9fkUXkllgjobkf/zdUiX1OZ53KlnlBfrCLNTD76z6W6j+wm/MTxi +F2TKf6tXFM+YHtaBe3pgG0ssVkqEIYTyzYFGsBD9oms/3jxjgfoNaLTaYRVqQa5goL3 c8OAThfO2bNv8v9pOXCdnkWPn6xzfkhYqypXjBu/ntMLlxN6L5iaFIIz/wKhvW9eQmxq 2JuvXivZpT/dxfZZKEVuBlb4nzwD/uQfRNospzkKf4Psplu+nC4Mc3jSWZzLBlatx7an fn59zVBpKgBr7IUIAyEfo7VYsrXU0ac+yqnOdN57jIF14GdeikM/eLiMhXdN4erzkDuO VxHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TZFWlteU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22-v6si16643806pgb.472.2018.10.17.07.58.56; Wed, 17 Oct 2018 07:59:12 -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=TZFWlteU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727699AbeJQWy3 (ORCPT + 99 others); Wed, 17 Oct 2018 18:54:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:40262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbeJQWy3 (ORCPT ); Wed, 17 Oct 2018 18:54:29 -0400 Received: from localhost (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 CA3AC2150F; Wed, 17 Oct 2018 14:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539788305; bh=1YNBN0SBWtjodADNrh/Kwtb41xdMAGI2MpXJSkEap6o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TZFWlteUkWITpyDZU2IwBZ2aRRrwFp7ZNwmaltmc7Kengrsz4vJDF5HVpWNe6jxXT KBbau5+0dnNLhDC3Wrb+45vFdtm9DNyYIpKDO5J3RxyxMwrvCqJQMEJ69b0eB8aMKO 5L1kiiXD2k4X7Pt8X7ZzmI1nuXxqXl+V7CzqqnwQ= Date: Wed, 17 Oct 2018 10:58:23 -0400 From: Sasha Levin To: Nishad Kamdar Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com Subject: Re: [PATCH v2] staging: iio: ad7816: Switch to the gpio descriptor interface Message-ID: <20181017145823.GC135013@sasha-vm> References: <20181017144716.GA11485@nishad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20181017144716.GA11485@nishad> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 17, 2018 at 08:17:20PM +0530, Nishad Kamdar wrote: >+ chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_IN); >+ if (IS_ERR(chip->rdwr_pin)) { >+ ret = PTR_ERR(chip->rdwr_pin); >+ dev_err(&spi_dev->dev, "Failed to request rdwr GPIO: %d\n", >+ ret); > return ret; > } >- gpio_direction_input(chip->rdwr_pin); >- ret = devm_gpio_request(&spi_dev->dev, chip->convert_pin, >- spi_get_device_id(spi_dev)->name); >- if (ret) { >- dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n", >- chip->convert_pin); >+ chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert", GPIOD_IN); >+ if (IS_ERR(chip->convert_pin)) { >+ ret = PTR_ERR(chip->convert_pin); >+ dev_err(&spi_dev->dev, "Failed to request convert GPIO: %d\n", >+ ret); > return ret; > } >- gpio_direction_input(chip->convert_pin); >- ret = devm_gpio_request(&spi_dev->dev, chip->busy_pin, >- spi_get_device_id(spi_dev)->name); >- if (ret) { >- dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n", >- chip->busy_pin); >+ chip->busy_pin = devm_gpiod_get(&spi_dev->dev, "busy", GPIOD_IN); >+ if (IS_ERR(chip->busy_pin)) { >+ ret = PTR_ERR(chip->busy_pin); >+ dev_err(&spi_dev->dev, "Failed to request busy GPIO: %d\n", >+ ret); > return ret; > } Hm, from what I can tell devm_gpio_request() is allocating some memory, which makes this a series of 4 allocations. What happens if the fourth allocation fails? Do we leak the first three? -- Thanks, Sasha