Commit b15e6534 authored by Himal Prasad Ghimiray's avatar Himal Prasad Ghimiray Committed by Rodrigo Vivi

drm/xe/xe_devcoredump: Check NULL before assignments

Assign 'xe_devcoredump_snapshot *' and 'xe_device *' only if
'coredump' is not NULL.

v2
- Fix commit messages.

v3
- Define variables before code.(Ashutosh/Jose)

v4
- Drop return check for coredump_to_xe. (Jose/Rodrigo)

v5
- Modify misleading commit message. (Matt)

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240328123739.3633428-1-himal.prasad.ghimiray@intel.comSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 345dadc4
...@@ -77,17 +77,19 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset, ...@@ -77,17 +77,19 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
size_t count, void *data, size_t datalen) size_t count, void *data, size_t datalen)
{ {
struct xe_devcoredump *coredump = data; struct xe_devcoredump *coredump = data;
struct xe_device *xe = coredump_to_xe(coredump); struct xe_device *xe;
struct xe_devcoredump_snapshot *ss = &coredump->snapshot; struct xe_devcoredump_snapshot *ss;
struct drm_printer p; struct drm_printer p;
struct drm_print_iterator iter; struct drm_print_iterator iter;
struct timespec64 ts; struct timespec64 ts;
int i; int i;
/* Our device is gone already... */ if (!coredump)
if (!data || !coredump_to_xe(coredump))
return -ENODEV; return -ENODEV;
xe = coredump_to_xe(coredump);
ss = &coredump->snapshot;
/* Ensure delayed work is captured before continuing */ /* Ensure delayed work is captured before continuing */
flush_work(&ss->work); flush_work(&ss->work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment