Commit be50112e authored by Federico Vaga's avatar Federico Vaga

drv: bug fix when building scatterlist on 5.10

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 93a04fd1
...@@ -294,9 +294,8 @@ static int sg_alloc_table_from_block(struct device *dev, ...@@ -294,9 +294,8 @@ static int sg_alloc_table_from_block(struct device *dev,
size_t max_segment_size; size_t max_segment_size;
void *data; void *data;
int i; int i;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) int err = 0;
int err; #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
#else
struct scatterlist *sg; struct scatterlist *sg;
#endif #endif
...@@ -338,10 +337,12 @@ static int sg_alloc_table_from_block(struct device *dev, ...@@ -338,10 +337,12 @@ static int sg_alloc_table_from_block(struct device *dev,
NULL, NULL,
0, 0,
GFP_KERNEL); GFP_KERNEL);
if (IS_ERR(sg)) if (IS_ERR(sg)) {
err = PTR_ERR(sg);
sg_free_table(sgt); sg_free_table(sgt);
}
kfree(pages); kfree(pages);
return PTR_ERR(sg); return err;
#endif #endif
} }
......
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