From patchwork Mon Jul 22 11:03:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 18514 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6327A25E1F for ; Mon, 22 Jul 2013 11:19:45 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hr11sf3907747vcb.5 for ; Mon, 22 Jul 2013 04:19:45 -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=h4cHQ8hftuvdFKukQ+Nlt77mwohFKRYdlnqsxs/99N8=; b=XSwU5XqqU/6rXPIDx/MKKYtMBFvF411Wkmv3moeR0+l1ceRo6q4YX/dHAseTprTF92 pH57WujhlCpZTDqIUOECloXwN3xuClt6lBOqYGyFJuSIOQw50GiCLKv5SAK0PdbwKF9S ElL1fN7l5/Q217upeYXSAG6aWTFiwjqQ1rWdOweLiL6PpoMUXz869P9d3y/ITjl8E+mz cjMLETSDYOMxOlpBB81WsfnZ8ofLtzQ0LMAlSnoAkuA1KH0+fUZmkNDMtA65JbGw+pJG r91+hsEE6Rt3oum2x4WZKOsOhmqjaRV+3XrM+4NHq2Xhy+t/oP9m+gTNACJqVoL6xpk4 tXtw== X-Received: by 10.236.129.178 with SMTP id h38mr14044169yhi.12.1374491985057; Mon, 22 Jul 2013 04:19:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.135 with SMTP id u7ls2472531qen.3.gmail; Mon, 22 Jul 2013 04:19:45 -0700 (PDT) X-Received: by 10.220.77.74 with SMTP id f10mr8896792vck.1.1374491984960; Mon, 22 Jul 2013 04:19:44 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id fa1si6897684ved.127.2013.07.22.04.19.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 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.54; Received: by mail-vb0-f54.google.com with SMTP id q12so4599978vbe.41 for ; Mon, 22 Jul 2013 04:19:44 -0700 (PDT) X-Received: by 10.220.203.197 with SMTP id fj5mr9499345vcb.60.1374491984881; Mon, 22 Jul 2013 04:19:44 -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 yu8csp50178veb; Mon, 22 Jul 2013 04:19:44 -0700 (PDT) X-Received: by 10.67.1.33 with SMTP id bd1mr31760980pad.75.1374491984037; Mon, 22 Jul 2013 04:19:44 -0700 (PDT) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by mx.google.com with ESMTPS id gh7si19561731pac.217.2013.07.22.04.19.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.180 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.192.180; Received: by mail-pd0-f180.google.com with SMTP id 10so6642405pdi.39 for ; Mon, 22 Jul 2013 04:19:43 -0700 (PDT) X-Received: by 10.68.189.8 with SMTP id ge8mr1306412pbc.160.1374491983663; Mon, 22 Jul 2013 04:19:43 -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.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:19:43 -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, Laxman Dewangan Subject: [PATCH 8/8] staging: iio: light: isl29028: Use devm_iio_device_alloc Date: Mon, 22 Jul 2013 16:33:01 +0530 Message-Id: <1374490981-24373-9-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: ALoCoQmS70QrgfKnL+eqbcDTtotJaEazNqpFlk+AM2E4WJAx6kMGCIeC6+nt6PAdpO/p935DP8xG X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.54 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: Laxman Dewangan --- drivers/staging/iio/light/isl29028.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index 8bb0d03..6014625 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -482,7 +482,7 @@ static int isl29028_probe(struct i2c_client *client, struct iio_dev *indio_dev; int ret; - indio_dev = iio_device_alloc(sizeof(*chip)); + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); if (!indio_dev) { dev_err(&client->dev, "iio allocation fails\n"); return -ENOMEM; @@ -498,13 +498,13 @@ static int isl29028_probe(struct i2c_client *client, if (IS_ERR(chip->regmap)) { ret = PTR_ERR(chip->regmap); dev_err(chip->dev, "regmap initialization failed: %d\n", ret); - goto exit_iio_free; + return ret; } ret = isl29028_chip_init(chip); if (ret < 0) { dev_err(chip->dev, "chip initialization failed: %d\n", ret); - goto exit_iio_free; + return ret; } indio_dev->info = &isl29028_info; @@ -517,13 +517,9 @@ static int isl29028_probe(struct i2c_client *client, if (ret < 0) { dev_err(chip->dev, "iio registration fails with error %d\n", ret); - goto exit_iio_free; + return ret; } return 0; - -exit_iio_free: - iio_device_free(indio_dev); - return ret; } static int isl29028_remove(struct i2c_client *client) @@ -531,7 +527,6 @@ static int isl29028_remove(struct i2c_client *client) struct iio_dev *indio_dev = i2c_get_clientdata(client); iio_device_unregister(indio_dev); - iio_device_free(indio_dev); return 0; }