From: Qiujun Huang <hqjagain@gmail.com>
To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
oohall@gmail.com
Cc: linux-kernel@vger.kernel.org, Markus.Elfring@web.de,
tglx@linutronix.de, linuxppc-dev@lists.ozlabs.org,
Qiujun Huang <hqjagain@gmail.com>
Subject: [PATCH v5 1/2] powerpc/powernv: Remove redundant assignments to attr and name
Date: Mon, 6 Apr 2020 20:52:41 +0800 [thread overview]
Message-ID: <20200406125242.4973-2-hqjagain@gmail.com> (raw)
In-Reply-To: <20200406125242.4973-1-hqjagain@gmail.com>
We don't need to go to the labal of out when of_property_read_u64_array
fails, as there is nothing to do. Just return.
And we can remove the redundant assignments to attr and name.
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/platforms/powernv/opal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2b3dfd0b6cdd..71af1cbc6334 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -801,14 +801,14 @@ static ssize_t export_attr_read(struct file *fp, struct kobject *kobj,
static int opal_add_one_export(struct kobject *parent, const char *export_name,
struct device_node *np, const char *prop_name)
{
- struct bin_attribute *attr = NULL;
- const char *name = NULL;
+ struct bin_attribute *attr;
+ const char *name;
u64 vals[2];
int rc;
rc = of_property_read_u64_array(np, prop_name, &vals[0], 2);
if (rc)
- goto out;
+ return rc;
attr = kzalloc(sizeof(*attr), GFP_KERNEL);
name = kstrdup(export_name, GFP_KERNEL);
--
2.17.1
next prev parent reply other threads:[~2020-04-06 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 12:52 [PATCH v5 0/2] Fix opal_add_one_export Qiujun Huang
2020-04-06 12:52 ` Qiujun Huang [this message]
2020-04-06 13:40 ` [PATCH v5 1/2] powerpc/powernv: Remove two unnecessary variable initialisations in opal_add_one_export() Markus Elfring
2020-04-06 14:56 ` [PATCH v5 1/2] powerpc/powernv: Return directly after a failed of_property_read_u64_array() " Markus Elfring
2020-04-06 12:52 ` [PATCH v5 2/2] powerpc/powernv: Add NULL check after kzalloc in opal_add_one_export Qiujun Huang
2020-04-06 14:00 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200406125242.4973-2-hqjagain@gmail.com \
--to=hqjagain@gmail.com \
--cc=Markus.Elfring@web.de \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).