fs/proc/proc_devtree.c: remove empty /proc/device-tree when no openfirmware exists.
authorDave Jones <davej@redhat.com>
Thu, 23 Jan 2014 23:55:43 +0000 (15:55 -0800)
committerMark Brown <broonie@kernel.org>
Mon, 16 Feb 2015 04:33:09 +0000 (13:33 +0900)
commitc90c3b6b054d2472bc654f95b73b0d27e91b0430
tree7776c042eb58cc76e85d8ddaa3f2fe6c55fde714
parentf57a8e20bfaa9ed2530f206c06a994072ca4ad88
fs/proc/proc_devtree.c: remove empty /proc/device-tree when no openfirmware exists.

Distribution kernels might want to build in support for /proc/device-tree
for kernels that might end up running on hardware that doesn't support
openfirmware.  This results in an empty /proc/device-tree existing.
Remove it if the OFW root node doesn't exist.

This situation actually confuses grub2, resulting in install failures.
grub2 sees the /proc/device-tree and picks the wrong install target cf.
http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/4300/util/grub-install.in#L311
grub should be more robust, but still, leaving an empty proc dir seems
pointless.

Addresses https://bugzilla.redhat.com/show_bug.cgi?id=818378.

Signed-off-by: Dave Jones <davej@redhat.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit c1d867a54d426b45da017fbe8e585f8a3064ce8d)
Signed-off-by: Mark Brown <broonie@kernel.org>
fs/proc/proc_devtree.c