From patchwork Fri Oct 13 07:35:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 115707 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp425006qgn; Fri, 13 Oct 2017 00:36:31 -0700 (PDT) X-Received: by 10.101.64.140 with SMTP id t12mr579847pgp.305.1507880191586; Fri, 13 Oct 2017 00:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507880191; cv=none; d=google.com; s=arc-20160816; b=BKBCmEhHIjgbzvYxg5nzLyacmo9cV75r3aWns36OvMrTj+kinkatZ48Xu7lt3wgN+H oXAxuXItXbNQ5wQ7nll4Xa+WFz+qstx55DlWSLYPUTRd8zI2v/PlMe0MGFschRGM4SaN JV2VvZF3Tbn3XSot/HYIr268M2C4IFDtNUV78P4WLGDo/QdF2GFgkjhv9vL7it8yITnI 6cIlZOxYko46cmrSmP5gFA/fz+kGX83My/I40ukq71ftOniTv0iGAuBg40wJN99Iybpu 9MJkf1e8oqWEj4mP7wT2wsANaK5IGy1HqmWfpimWaYXMo+VHtXzwTXXHFsvLgQN5TH7F 4Xrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vLwKxz9zA8fi1S/fCM+UnvR/7w6XSjqNFFxMuupOpnQ=; b=05hCcqhcR+q6XDwIRlgUzIvez1F2rtny14i9cc+f9/8w7IFxhMdcp7UvZhI93Hx3Op lK3jrGaw0vv3lErL80SXmVZ7Hm7jkWFzm49Ddi24npVN2sQY1gm7oPCCXbtBOX6yIp87 G7mDj3mhq9jmM5lPKqUjFWJBA5Z+GOrCU4D5fI+P4PabXozaJHNSyFd8tNwleApDR3N9 +AYgl7hPmxdb4jvlM0G9xOj8CO8dfS331vmG+y2YSey2EVxoDk8ixSGBqeiNT3N0i8og q1hsxi5WsUHvOe3Ow7qT2Pol4DUUUD3JRqZXUjH5G8A8KCxBIpa8SxG9M+VDQFiepL5c 2g1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mp2tNzdb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si265079pli.170.2017.10.13.00.36.31; Fri, 13 Oct 2017 00:36:31 -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=@linaro.org header.s=google header.b=Mp2tNzdb; 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 S1757392AbdJMHg3 (ORCPT + 27 others); Fri, 13 Oct 2017 03:36:29 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:50606 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751937AbdJMHgC (ORCPT ); Fri, 13 Oct 2017 03:36:02 -0400 Received: by mail-pf0-f176.google.com with SMTP id b6so464309pfh.7 for ; Fri, 13 Oct 2017 00:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vLwKxz9zA8fi1S/fCM+UnvR/7w6XSjqNFFxMuupOpnQ=; b=Mp2tNzdbFPsbPnNehPyNYKGMvbhAoYGQo5/rJr2pQyzHciRdqetlV2Frqgg+VKYAJV vyn1v3I3PNmX+L/R6r5y2mEnxfpUVr5+jx589AJn4w9K5oNhdX+Y4rjLVR3Y+uX5u+dM 3sCZb672UJWOlDppZWJES8YyrRBf1I/OhK+JU= 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:in-reply-to :references; bh=vLwKxz9zA8fi1S/fCM+UnvR/7w6XSjqNFFxMuupOpnQ=; b=dVXs/a3j3h6qeEqyX5fddKr0SjsyVO/A1uaY4FbJ21+cTjY8l0MGjJ81/tuI2LOjap q3gwL/dsI3I4Ctkg7z49d5Y3otT04Dy1Ljb1xJy4JPYEdRYuG6BjEjojiDEhhk09/qGV uc18fg23PjNM4br7qyOIYdRXR2b2CN3SjhoXDkPIXP5R8vrXZAQeOf/bsqaC9LeKz/Pw PP4Cu1w7bs/MvXGTel//L9lyPBtcv73JcMvKoPL0MBeiuKNBxxREjsbl09QFOhLsvbBt wYs+5JD2Em3/uqmNbrLHMCe0sp0hZo8Yo6SC40Ammipr/fjBY+bXMjQiyXWe9f/5Y6mW k28A== X-Gm-Message-State: AMCzsaVhoO1lplmVYyyfA3KkiAAWC+/DyoM8KOS+GhFYsBHcyHV8TSOP FZXZC0bgna/T1mLOhXH6adBvug== X-Google-Smtp-Source: AOwi7QA39BLiSX+cE1J9MB7O1JlByaxlm+azc8iuFbarFJ9dKPqMibpMeMjXOijG/Ve0KHVWvgLW4Q== X-Received: by 10.101.68.69 with SMTP id e5mr580889pgq.282.1507880162109; Fri, 13 Oct 2017 00:36:02 -0700 (PDT) Received: from localhost.localdomain (ip72-199-124-160.sd.sd.cox.net. [72.199.124.160]) by smtp.gmail.com with ESMTPSA id e4sm1038664pfa.80.2017.10.13.00.36.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Oct 2017 00:36:01 -0700 (PDT) From: Stephen Boyd To: Rob Herring , Frank Rowand Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/2] of/resolver: Simplify to be32_add_cpu() Date: Fri, 13 Oct 2017 00:35:57 -0700 Message-Id: <20171013073558.11518-2-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.14.GIT In-Reply-To: <20171013073558.11518-1-stephen.boyd@linaro.org> References: <20171013073558.11518-1-stephen.boyd@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is the same as be32_add_cpu(), so simplify the code and remove the now unused local variable. Signed-off-by: Stephen Boyd --- drivers/of/resolver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.14.GIT diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c index 99309cb7d372..2d58253bf2f7 100644 --- a/drivers/of/resolver.c +++ b/drivers/of/resolver.c @@ -165,7 +165,6 @@ static int adjust_local_phandle_references(struct device_node *local_fixups, struct property *prop_fix, *prop; int err, i, count; unsigned int off; - phandle phandle; if (!local_fixups) return 0; @@ -195,9 +194,7 @@ static int adjust_local_phandle_references(struct device_node *local_fixups, if ((off + 4) > prop->length) return -EINVAL; - phandle = be32_to_cpu(*(__be32 *)(prop->value + off)); - phandle += phandle_delta; - *(__be32 *)(prop->value + off) = cpu_to_be32(phandle); + be32_add_cpu(prop->value + off, phandle_delta); } } From patchwork Fri Oct 13 07:35:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 115706 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp424797qgn; Fri, 13 Oct 2017 00:36:14 -0700 (PDT) X-Received: by 10.84.248.77 with SMTP id e13mr626837pln.200.1507880173981; Fri, 13 Oct 2017 00:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507880173; cv=none; d=google.com; s=arc-20160816; b=Uzhw3Gzztgj7khgadWPX6HgNH15iKeqW2PS4gNYOXA1XZTn7uDGexfmQs1vY+LLjWm swmG+Trx0vcYcJc31ZvNuKU/rKnzTrUf2o4JCgN/h66optCwkJNlzxanucpfYluWci60 zKWETBlrKNCi7uaBLIxd9s4BQ1gx+l3lH4PXJ1qPkYMJdD7Wf7kiQ7PD7y/6OGzEM5Lb lRlqiP1eY6SH043Tyhou/CU2ic0/lopiarT4ZFaEXVV7ugw5J61v0FMdPaTKPoO7bk2s Z/Fyx8X1Agmla1yhQ5HR3Ixd21RmfRKUn7AzFXJqi1IiFquUBBkFkmGFlZjvBjDURqOg iQgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dhlEBY/wiDrI+Z/o76vwSiFzV+b/kpaaQty8N2N3jyw=; b=RKkRv0BGdPNlLJ0sNiSYW6ywA1PBwX4acI2Cay7PGnFU7vUB0iwyMCvZukvaO40tog u7wKiu+G3BYa15Nwi659IKly917mCMzdvRVumXNFVqy07de7nCDxBvqLUxY/dd8jiC0r slZG1noysN4zoUAeXEh54VL6VvS2VQJ5ld2J58Tl+MYrBYev8yrW4Dx1FTmenV11Rydh S6s96vQDvH6s114Z1lFsS0x0PJC0VwUeCfQHE5hYw9/z3cy05VfCe3fCtbITYgmbBljC LS9PeA3tCSdi/rCExZk6hbKh9d5NRGp0jvxfHQ9+rQTRVgk+yhU+HPpLXwuzTXhaDjmy dGQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GzEP4sXQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70si269525plc.113.2017.10.13.00.36.13; Fri, 13 Oct 2017 00:36:13 -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=@linaro.org header.s=google header.b=GzEP4sXQ; 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 S1757152AbdJMHgI (ORCPT + 27 others); Fri, 13 Oct 2017 03:36:08 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:57324 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753498AbdJMHgD (ORCPT ); Fri, 13 Oct 2017 03:36:03 -0400 Received: by mail-pf0-f173.google.com with SMTP id b85so8856541pfj.13 for ; Fri, 13 Oct 2017 00:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dhlEBY/wiDrI+Z/o76vwSiFzV+b/kpaaQty8N2N3jyw=; b=GzEP4sXQZnKo3S1zVdp5VtsxSstKYWvUShyLRl2nE5/gbe2VSNzIzqmkDR2N2otdes mzDqKHOkHeuKi7EXfu0M2/v6lvFHTKe0pkmbAXT1oh1C2obwj9+R8H9rJWWpWLkHfj3b 4bk5o/PXfCtRjx+djMQhECEIbtNkkPJTZF2hs= 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:in-reply-to :references; bh=dhlEBY/wiDrI+Z/o76vwSiFzV+b/kpaaQty8N2N3jyw=; b=sJfNr7Ui8EXThpTtcuqtZXY67WsK30xMMtFMadXJRC4VtYpmpfzjYC06pVgkvhPy9y 35vW5YBKSL5hpge/DyDg8ShBwhjDHIw0bJpkiPH4q7pZvUVdTcAe/E85bSUJruSIIxl2 gOIC7AwUfk/9wnwIKGLyReyFTDuKIH2BIQZyjaYHUrx4o4zYLlcXCnXQru0G8iuXNFfN 0vg6mXxVhmfT9s3R8ANotk3F09rjkPBO+8EqHY0fVLt/swkrSeYZHhzHzQMPPor6DwbP fxactJRgk0WWE/ne50KUu/JTFnq4O4nSvU6zLKSR5R0HTnLYr2Scg3gMPhsPWyfU+3E3 xzRQ== X-Gm-Message-State: AMCzsaUa9LdjqsvkmJkry0zhVAXypC3jgQaT6jTWphTnp6M/GstVeo5N B+cIa0T9OsTqtJY7zMyc3PfTQw== X-Google-Smtp-Source: AOwi7QDz5J3SJ6t8vNoE2Uyg+cTJ/r2XtHUNj0vg75zPejfVZ4fivveUJLZpFqgl+CQ2H9DF5pO6WQ== X-Received: by 10.99.124.24 with SMTP id x24mr586978pgc.90.1507880162999; Fri, 13 Oct 2017 00:36:02 -0700 (PDT) Received: from localhost.localdomain (ip72-199-124-160.sd.sd.cox.net. [72.199.124.160]) by smtp.gmail.com with ESMTPSA id e4sm1038664pfa.80.2017.10.13.00.36.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Oct 2017 00:36:02 -0700 (PDT) From: Stephen Boyd To: Rob Herring , Frank Rowand Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup() Date: Fri, 13 Oct 2017 00:35:58 -0700 Message-Id: <20171013073558.11518-3-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.14.GIT In-Reply-To: <20171013073558.11518-1-stephen.boyd@linaro.org> References: <20171013073558.11518-1-stephen.boyd@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Save one line. Signed-off-by: Stephen Boyd --- drivers/of/resolver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.14.GIT diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c index 2d58253bf2f7..bd21a66f6930 100644 --- a/drivers/of/resolver.c +++ b/drivers/of/resolver.c @@ -84,10 +84,9 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay, int offset, len; int err = 0; - value = kmalloc(prop_fixup->length, GFP_KERNEL); + value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL); if (!value) return -ENOMEM; - memcpy(value, prop_fixup->value, prop_fixup->length); /* prop_fixup contains a list of tuples of path:property_name:offset */ end = value + prop_fixup->length;