From: Stephen Boyd Date: Fri, 12 Apr 2019 18:31:45 +0000 (-0700) Subject: driver core: Let dev_of_node() accept a NULL dev X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1b833924e5b3cea92306069a0f366529341dd260;p=linux.git driver core: Let dev_of_node() accept a NULL dev We'd like to chain this in places where the 'dev' argument might be NULL. Let this function take a NULL 'dev' so this can work. Cc: Miquel Raynal Cc: Jerome Brunet Cc: Russell King Cc: Michael Turquette Cc: Jeffrey Hugo Cc: Chen-Yu Tsai Cc: Greg Kroah-Hartman Cc: Rob Herring Acked-by: Greg Kroah-Hartman Tested-by: Jeffrey Hugo Signed-off-by: Stephen Boyd --- diff --git a/include/linux/device.h b/include/linux/device.h index b425a7ee04ce4..0370dd0b3ae7d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1231,7 +1231,7 @@ static inline void device_lock_assert(struct device *dev) static inline struct device_node *dev_of_node(struct device *dev) { - if (!IS_ENABLED(CONFIG_OF)) + if (!IS_ENABLED(CONFIG_OF) || !dev) return NULL; return dev->of_node; }