Re: [PATCH 01/24] kobject: return actual error on kset_create_and_add

From: James Bottomley
Date: Tue Jun 17 2014 - 10:43:00 EST


On Tue, 2014-06-17 at 22:25 +0800, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@xxxxxxxxxx>
>
> It's better to return the actual error rather than NULL because
> kset_register() can failed due to other reasons.
>
> Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Pekka Enberg <penberg@xxxxxxxxxx>
> Cc: Matt Mackall <mpm@xxxxxxxxxxx>
> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxx>
> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
> Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Cc: David S. Miller <davem@xxxxxxxxxxxxx>
> Cc: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>
> Cc: Joerg Roedel <joro@xxxxxxxxxx>
> Cc: James E.J. Bottomley <JBottomley@xxxxxxxxxxxxx>
> Cc: Helge Deller <deller@xxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: Chris Mason <clm@xxxxxx>
> Cc: Josef Bacik <jbacik@xxxxxx>
> Cc: Steven Whitehouse <swhiteho@xxxxxxxxxx>
> Cc: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
> Cc: Benny Halevy <bhalevy@xxxxxxxxxxxxxxx>
> Cc: Christine Caulfield <ccaulfie@xxxxxxxxxx>
> Cc: David Teigland <teigland@xxxxxxxxxx>
> Cc: Theodore Ts'o <tytso@xxxxxxx>
> Cc: Andreas Dilger <adilger.kernel@xxxxxxxxx>
> Cc: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
> Cc: Changman Lee <cm224.lee@xxxxxxxxxxx>
> Cc: Mark Fasheh <mfasheh@xxxxxxxx>
> Cc: Joel Becker <jlbec@xxxxxxxxxxxx>
> Cc: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>
> Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
> ---
> lib/kobject.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/kobject.c b/lib/kobject.c
> index 58751bb..538c617 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -919,11 +919,11 @@ struct kset *kset_create_and_add(const char *name,
>
> kset = kset_create(name, uevent_ops, parent_kobj);
> if (!kset)
> - return NULL;
> + return ERR_PTR(-ENOMEM);
> error = kset_register(kset);
> if (error) {
> kfree(kset);
> - return NULL;
> + return ERR_PTR(error);
> }
> return kset;
> }

This patch series isn't bisectable. When changing an error signal from
NULL to non-NULL, you have to do it as one patch, otherwise if a
bisection lands in here we'll get error returns from all our kobject
kset code and the kernel won't boot.

It's fine if you're sending it out as 24 patches for review, but it has
to be applied as a single one.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/