[PATCH 1/3] drm/xe: Return if kobj creation is failed
Upadhyay, Tejas
tejas.upadhyay at intel.com
Fri Mar 8 05:18:43 UTC 2024
> -----Original Message-----
> From: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>
> Sent: Friday, March 8, 2024 10:07 AM
> To: intel-xe at lists.freedesktop.org
> Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>; Sundaresan,
> Sujaritha <sujaritha.sundaresan at intel.com>; Upadhyay, Tejas
> <tejas.upadhyay at intel.com>; Bommu, Krishnaiah
> <krishnaiah.bommu at intel.com>
> Subject: [PATCH 1/3] drm/xe: Return if kobj creation is failed
>
> Return after warning regarding kobj creation failure.
>
> Fixes: 4ae3aeab32d7 ("drm/xe: Add vram frequency sysfs attributes")
> Cc: Sujaritha Sundaresan <sujaritha.sundaresan at intel.com>
> Cc: Tejas Upadhyay <tejas.upadhyay at intel.com>
> Cc: Bommu Krishnaiah <krishnaiah.bommu at intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> ---
> drivers/gpu/drm/xe/xe_vram_freq.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vram_freq.c
> b/drivers/gpu/drm/xe/xe_vram_freq.c
> index 079cc283a186..c5f6b5a5d117 100644
> --- a/drivers/gpu/drm/xe/xe_vram_freq.c
> +++ b/drivers/gpu/drm/xe/xe_vram_freq.c
> @@ -111,8 +111,10 @@ void xe_vram_freq_sysfs_init(struct xe_tile *tile)
> return;
>
> kobj = kobject_create_and_add("memory", tile->sysfs);
> - if (!kobj)
> + if (!kobj) {
> drm_warn(&xe->drm, "failed to add memory directory, err:
> %d\n", -ENOMEM);
> + return;
> + }
LGTM, had kobj not created this would have thrown crash in next line of execution. Good catch.
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
>
> err = sysfs_create_group(kobj, &freq_group_attrs);
> if (err) {
> --
> 2.25.1
More information about the Intel-xe
mailing list