From patchwork Thu Jan 19 10:47:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 92019 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp422024qgi; Thu, 19 Jan 2017 10:47:12 -0800 (PST) X-Received: by 10.98.76.132 with SMTP id e4mr11866043pfj.24.1484851632660; Thu, 19 Jan 2017 10:47:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 134si4316027pgh.30.2017.01.19.10.47.12; Thu, 19 Jan 2017 10:47:12 -0800 (PST) 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=@linaro.org; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754397AbdASSrK (ORCPT + 25 others); Thu, 19 Jan 2017 13:47:10 -0500 Received: from mail-pg0-f52.google.com ([74.125.83.52]:36447 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754212AbdASSrI (ORCPT ); Thu, 19 Jan 2017 13:47:08 -0500 Received: by mail-pg0-f52.google.com with SMTP id t6so16213634pgt.3 for ; Thu, 19 Jan 2017 10:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=qCo+G7w6lHti6FAZzsB2N1B7HO48drIV4MRYiQrujKo=; b=O0Nbv7Xkg5OelymFQQXn64wrV1Zms+FV6Jj+5SPV8hDoWVsRcF5dv0//xv6m7OzlzT FulBs0IVNQvbKxwarD2pWngSXrnmxZhk9gIY/WzQiG+85T8Wk8aMRZWC0jPrU0el40O9 7E5M5dlbMEYJbfOJ6GwK28QPNXxlNxRsKaVCs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qCo+G7w6lHti6FAZzsB2N1B7HO48drIV4MRYiQrujKo=; b=HYdJy0o5qLXKNiHtT4m4qZviwdcPknBnoaLe/oO7XnegefXx1I7nWy8Zgy3kuCHSLb ccQdfYpxe6qXEKq1McrvXfizdDpFj1728iZDkWB/VefaCO701h+3xz0mt+xhKyaQc8wi 1WtwGoyK3PKtuyTjdgnwHJOWhzgVfgkhAan0GcUDjtSNIZNuD0QOAE6C8qXQfX6L4i/U vJyqAF30Pgsb4W5I6r9LOX5cI0CtaOPXIRtSe49Ois2BRrYCnOyx0k2KdjVEeRccAavF y6cjB9ljs/DT77qKgcCNRtT+ZfQ7kc3C5lgjRhDIjRvn9lWYOz6dpBYYtK4R9TnGke1K E/iw== X-Gm-Message-State: AIkVDXKLng1bvZcDi3laUhjiMM5K6JbaYqzMHR0MzKCwwIQRQsC8ZXTgt8YYmpHr5JRqhgkb X-Received: by 10.99.125.68 with SMTP id m4mr11836430pgn.13.1484851609167; Thu, 19 Jan 2017 10:46:49 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id w76sm10552990pfd.74.2017.01.19.10.46.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 10:46:48 -0800 (PST) From: Bjorn Andersson To: Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Subhash Jadavani , Vivek Gautam Subject: [PATCH 1/4] phy: qcom-ufs: Don't kfree devres resource Date: Thu, 19 Jan 2017 02:47:36 -0800 Message-Id: <20170119104739.4376-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Upon failing to acquire regulator supplies the qcom-ufs driver calls kfree() on the devm allocated memory used to store the name of the regulator, leading to devres corruption. Rather than switching to using the appropriate free function the patch acknowledge the fact that "name" is always a constant string and we don't actually need to create a local copy of it, but rather just reference the constant string. Cc: Subhash Jadavani Cc: Vivek Gautam Signed-off-by: Bjorn Andersson --- drivers/phy/phy-qcom-ufs.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.11.0 Reviewed-by: Subhash Jadavani diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c index c69568b8543d..4d7f3c018223 100644 --- a/drivers/phy/phy-qcom-ufs.c +++ b/drivers/phy/phy-qcom-ufs.c @@ -217,12 +217,7 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev, char prop_name[MAX_PROP_NAME]; - vreg->name = devm_kstrdup(dev, name, GFP_KERNEL); - if (!vreg->name) { - err = -ENOMEM; - goto out; - } - + vreg->name = name; vreg->reg = devm_regulator_get(dev, name); if (IS_ERR(vreg->reg)) { err = PTR_ERR(vreg->reg); @@ -265,8 +260,6 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev, } out: - if (err) - kfree(vreg->name); return err; }