From patchwork Mon Jul 22 11:03:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 18513 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C9D1225E1F for ; Mon, 22 Jul 2013 11:19:41 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id a1sf8378214qcx.6 for ; Mon, 22 Jul 2013 04:19:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=ZNiqZ+kpQ9lzv2tNfMJRvghrYKSPMBb+rUaGM9Uxye0=; b=UMT5m+fBMUT2hFgn5h85wPlJslvGgSd3JVYaJGmwJyukaWETee9BlJYzMkjrJllNum phiqBS77auek/N9KiMTlgI136ygPwPqqiipoK7v0TtGLu+9kiDbHyRuYAFGlhc5g2Owf HZMOt34J/sIBc+j2cXjYsu5t0xg+FiPajlPnTANgilSmXXviCOLSXdnXI9GZ4BOmI4uG crzp9MQ+IeV2D3PsBY2QavqhjWBeMr+C4ByFsecbk6sysjPw6zhfdxTbamd+YGiJDLPz fs6Wfrxpl2lO/1HH7Gzz3r29rbXkZHq1vY7bDVvF04wtPJ/Wy6l893IL9qcYZlu/ZKGv gcyg== X-Received: by 10.236.120.232 with SMTP id p68mr15621740yhh.43.1374491981592; Mon, 22 Jul 2013 04:19:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.233 with SMTP id b9ls2560736qec.14.gmail; Mon, 22 Jul 2013 04:19:41 -0700 (PDT) X-Received: by 10.52.165.209 with SMTP id za17mr7712358vdb.60.1374491981483; Mon, 22 Jul 2013 04:19:41 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id ex7si6895590vdb.148.2013.07.22.04.19.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id 10so4659950vbe.19 for ; Mon, 22 Jul 2013 04:19:41 -0700 (PDT) X-Received: by 10.220.67.10 with SMTP id p10mr8992095vci.85.1374491981398; Mon, 22 Jul 2013 04:19:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp50176veb; Mon, 22 Jul 2013 04:19:40 -0700 (PDT) X-Received: by 10.69.8.65 with SMTP id di1mr23486293pbd.32.1374491980545; Mon, 22 Jul 2013 04:19:40 -0700 (PDT) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx.google.com with ESMTPS id co1si18461791pbc.288.2013.07.22.04.19.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.41; Received: by mail-pa0-f41.google.com with SMTP id bj3so6978459pad.14 for ; Mon, 22 Jul 2013 04:19:40 -0700 (PDT) X-Received: by 10.66.193.228 with SMTP id hr4mr29550243pac.163.1374491980169; Mon, 22 Jul 2013 04:19:40 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id ry2sm35249515pbc.41.2013.07.22.04.19.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:39 -0700 (PDT) From: Sachin Kamat To: linux-iio@vger.kernel.org Cc: jic23@cam.ac.uk, jic23@kernel.org, sachin.kamat@linaro.org, patches@linaro.org, Rhyland Klein Subject: [PATCH 7/8] staging: iio: light: isl29018: Use devm_iio_device_alloc Date: Mon, 22 Jul 2013 16:33:00 +0530 Message-Id: <1374490981-24373-8-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374490981-24373-1-git-send-email-sachin.kamat@linaro.org> References: <1374490981-24373-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQnrWbRk9pW4LDBrHJd0QpYy03vR5PP1Z6XJNHkdc/1uMxGjevBWXx1S820Ei+yEw2AcNuKP X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat Cc: Rhyland Klein Acked-by: Rhyland Klein --- drivers/staging/iio/light/isl29018.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 82478a5..351936c 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -550,11 +550,10 @@ static int isl29018_probe(struct i2c_client *client, struct iio_dev *indio_dev; int err; - indio_dev = iio_device_alloc(sizeof(*chip)); + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); if (indio_dev == NULL) { dev_err(&client->dev, "iio allocation fails\n"); - err = -ENOMEM; - goto exit; + return -ENOMEM; } chip = iio_priv(indio_dev); @@ -572,12 +571,12 @@ static int isl29018_probe(struct i2c_client *client, if (IS_ERR(chip->regmap)) { err = PTR_ERR(chip->regmap); dev_err(chip->dev, "regmap initialization failed: %d\n", err); - goto exit; + return err; } err = isl29018_chip_init(chip); if (err) - goto exit_iio_free; + return err; indio_dev->info = &isl29108_info; indio_dev->channels = isl29018_channels; @@ -588,14 +587,10 @@ static int isl29018_probe(struct i2c_client *client, err = iio_device_register(indio_dev); if (err) { dev_err(&client->dev, "iio registration fails\n"); - goto exit_iio_free; + return err; } return 0; -exit_iio_free: - iio_device_free(indio_dev); -exit: - return err; } static int isl29018_remove(struct i2c_client *client) @@ -604,7 +599,6 @@ static int isl29018_remove(struct i2c_client *client) dev_dbg(&client->dev, "%s()\n", __func__); iio_device_unregister(indio_dev); - iio_device_free(indio_dev); return 0; }